84 bool exist(
const QString & sKey)
const;
91 bool insert(
const QString & sKey,
const qx::any & anyObj,
long lCost = 1,
const QDateTime & dt = QDateTime());
155inline bool exist(
const QString & sKey)
170inline bool set(
const QString & sKey, T & t,
long lCost = 1,
const QDateTime & dt = QDateTime())
181inline T
get(
const QString & sKey)
184 if (obj.
empty()) {
return T(); }
187 catch (...) {
return T(); }
195inline qx_bool get(
const QString & sKey, T & t, QDateTime & dt)
202 catch (
const qx::bad_any_cast & err) { Q_UNUSED(err);
return qx_bool(
false, 0,
"[QxOrm] qx::cache : bad any cast exception"); }
203 catch (...) {
return qx_bool(
false, 0,
"[QxOrm] qx::cache : unknown cast exception"); }
qx::any : basic implementation of boost::any (written by Kevlin Henney) when boost dependency is not ...
qx_bool : QxOrm library boolean type with code and description message when an error occured
QxOrm thread-safe container (keep insertion order + quick access by index + quick access by key)
#define QX_DLL_EXPORT_QX_SINGLETON_HPP(x)
Concrete class to define a thread-safe singleton of QxOrm library.
qx_bool : boolean type with code and description message when an error occured
qx::QxCollection<Key, Value> : QxOrm thread-safe container (keep insertion order + quick access by in...
qx::QxSingleton<T> : concrete class to define a thread-safe singleton of type T
static QxCache * getSingleton()
long m_lMaxCost
Max cost before deleting object in cache.
long m_lCurrCost
Current cost in cache.
long insertionCost(const QString &sKey)
bool exist(const QString &sKey) const
bool insert(const QString &sKey, const qx::any &anyObj, long lCost=1, const QDateTime &dt=QDateTime())
type_qx_lst_cache m_cache
List of objects in cache under qx::any format.
qx::any at(const QString &sKey)
std::tuple< long, QDateTime, qx::any > type_qx_cache
QDateTime insertionDateTime(const QString &sKey)
QMutex m_oMutexCache
Mutex => 'QxCache' is thread-safe.
bool contains(const QString &sKey) const
qx::QxCollection< QString, type_qx_cache > type_qx_lst_cache
bool remove(const QString &sKey)
bool is_empty()
Return true if the cache contains no object; otherwise return false.
bool exist(const QString &sKey)
Return true if the cache contains an object associated with key sKey; otherwise return false.
long max_cost()
Return the maximum allowed total cost of the cache.
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....
void clear()
Delete all the objects in the cache.
long current_cost()
Return the current cost used by the cache.
bool remove(const QString &sKey)
Delete the object associated with key sKey. Return true if the object was found in the cache; otherwi...
long count()
Return the number of objects in the cache.
T get(const QString &sKey)
Return the object of type T associated with key sKey, or return default instance of T() if the key do...
Root namespace for all QxOrm library features.
ValueType * any_cast(any *)