The XCachedHash combines a templated QHash with a QObject that clears itself upon receipt of a specific database notification or set of notifications. More...
#include <xcachedhash.h>
Public Member Functions | |
virtual | ~XCachedHash () |
virtual const V | value (const K &key) |
Protected Member Functions | |
XCachedHash (QObject *pParent, const QStringList &pNotification, QSqlDatabase pDb=QSqlDatabase::database()) | |
XCachedHash (QObject *pParent=0, const QString &pNotification=QString(), QSqlDatabase pDb=QSqlDatabase::database()) | |
virtual void | clear () |
virtual bool | refresh (const K &key)=0 |
void | setNotification (QStringList pNotification) |
Protected Attributes | |
QSqlDatabase | _db |
The XCachedHash combines a templated QHash with a QObject that clears itself upon receipt of a specific database notification or set of notifications.
This allows for straightforward access to a named object that's stored in the database, such as a script or metasql statement with minimal database access. The database is queried whenever a named object is not in the hash. The value retrieved from the database is stored in the hash and returned to the caller. The next time a caller requests that object, it is returned from the hash directly. The hash clears itself when the named database notification is received. Thus the next time a caller requests that named object, the hash requeries.
This is currently designed to be subclassed.
|
inlinevirtual |
|
inlineprotected |
|
inlineprotected |
|
inlineprotectedvirtual |
|
protectedpure virtual |
|
inlineprotected |
|
inlinevirtual |
|
protected |
Generated on Mon May 3 2021 | xTuple ERP Programmer Reference, Version 4.12.0 | 1.8.17 |