QxOrm
1.5.0
C++ Object Relational Mapping library
|
Provide basic thread-safe cache feature to backup and restore any kind of objects (for example, object fetched from database) More...
Namespaces | |
namespace | detail |
Internal helper tools for qx::cache namespace. | |
Functions | |
void | 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 | max_cost () |
Return the maximum allowed total cost of the cache. | |
long | current_cost () |
Return the current cost used by the cache. | |
long | count () |
Return the number of objects in the cache. | |
bool | is_empty () |
Return true if the cache contains no object; otherwise return false. | |
void | clear () |
Delete all the objects in the cache. | |
bool | exist (const QString &sKey) |
Return true if the cache contains an object associated with key sKey; otherwise return false. | |
bool | 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 | set (const QString &sKey, T &t, long lCost=1, const QDateTime &dt=QDateTime()) |
Insert object t into the cache with key sKey, associated cost lCost and insertion date-time dt. Any object with the same key already in the cache will be removed. | |
template<typename T > | |
T | 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 | get (const QString &sKey, T &t, QDateTime &dt) |
Return true if object t can be fetched with associated key sKey and insertion date-time dt; otherwise return false with an error description. | |
template<typename T > | |
qx_bool | 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. |
Provide basic thread-safe cache feature to backup and restore any kind of objects (for example, object fetched from database)