QxOrm 1.1.6
C++ Object Relational Mapping library
QxCache : QxOrm library basic thread-safe cache feature to backup and restore any kind of objects (for example, object fetched from database)

Namespaces

namespace  qx::cache
 

Provide basic thread-safe cache feature to backup and restore any kind of objects (for example, object fetched from database)


namespace  qx::cache::detail
 

Internal helper tools for qx::cache namespace.


Files

file  QxCache.h
 

qx::cache : based on singleton pattern, provide basic thread-safe cache feature to backup and restore any kind of objects (for example, object fetched from database)


Functions

void qx::cache::max_cost (long l)
 Set the maximum allowed total cost of the cache to l. If the current total cost is greater than l, some objects are deleted immediately.
long qx::cache::max_cost ()
 Return the maximum allowed total cost of the cache.
long qx::cache::current_cost ()
 Return the current cost used by the cache.
long qx::cache::count ()
 Return the number of objects in the cache.
bool qx::cache::is_empty ()
 Return true if the cache contains no object; otherwise return false.
void qx::cache::clear ()
 Delete all the objects in the cache.
bool qx::cache::exist (const QString &sKey)
 Return true if the cache contains an object associated with key sKey; otherwise return false.
bool qx::cache::remove (const QString &sKey)
 Delete the object associated with key sKey. Return true if the object was found in the cache; otherwise return false.
template<typename T >
bool qx::cache::set (const QString &sKey, const T &t, long lCost=1)
 Insert object t into the cache with key sKey and associated cost lCost. Any object with the same key already in the cache will be removed.
template<typename T >
qx::cache::get (const QString &sKey)
 Return the object of type T associated with key sKey, or return default instance of T() if the key does not exist in the cache.
template<typename T >
qx_bool qx::cache::get (const QString &sKey, T &t)
 Return true if object t can be fetched with associated key sKey; otherwise return false with an error description.

Function Documentation

void qx::cache::clear ( ) [inline]

Delete all the objects in the cache.

Definition at line 129 of file QxCache.h.

long qx::cache::count ( ) [inline]

Return the number of objects in the cache.

Definition at line 117 of file QxCache.h.

long qx::cache::current_cost ( ) [inline]

Return the current cost used by the cache.

Definition at line 111 of file QxCache.h.

bool qx::cache::exist ( const QString &  sKey) [inline]

Return true if the cache contains an object associated with key sKey; otherwise return false.

Definition at line 135 of file QxCache.h.

template<typename T >
T qx::cache::get ( const QString &  sKey) [inline]

Return the object of type T associated with key sKey, or return default instance of T() if the key does not exist in the cache.

Definition at line 156 of file QxCache.h.

template<typename T >
qx_bool qx::cache::get ( const QString &  sKey,
T &  t 
) [inline]

Return true if object t can be fetched with associated key sKey; otherwise return false with an error description.

Definition at line 169 of file QxCache.h.

bool qx::cache::is_empty ( ) [inline]

Return true if the cache contains no object; otherwise return false.

Definition at line 123 of file QxCache.h.

long qx::cache::max_cost ( ) [inline]

Return the maximum allowed total cost of the cache.

Definition at line 105 of file QxCache.h.

void qx::cache::max_cost ( long  l) [inline]

Set the maximum allowed total cost of the cache to l. If the current total cost is greater than l, some objects are deleted immediately.

Definition at line 99 of file QxCache.h.

bool qx::cache::remove ( const QString &  sKey) [inline]

Delete the object associated with key sKey. Return true if the object was found in the cache; otherwise return false.

Definition at line 141 of file QxCache.h.

template<typename T >
bool qx::cache::set ( const QString &  sKey,
const T &  t,
long  lCost = 1 
) [inline]

Insert object t into the cache with key sKey and associated cost lCost. Any object with the same key already in the cache will be removed.

Definition at line 148 of file QxCache.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines