#include <voidCache.h>
Public Member Functions | |
virtual void | clear () |
Synchronizes states of the cache and database. | |
virtual CacheLock & | makePersistent (const PersIdentification &persId, DatabaseObject &objectPtr) |
Saves an object into database. | |
virtual CacheLock & | getCacheLock (const PersIdentification &persId, bool rdonly=false) |
Assures an object is in cache, locks it and returns an instance making it possible to access the object. | |
virtual void | dbDelete (const PersIdentification &persId) |
Deletes an object. | |
virtual void | cacheDelete (const PersIdentification &persId) |
Represents a hint for the cache to remove local copy of an object. | |
virtual void | updateDirty () |
Synchronize the state of cache and DB by updating the DB. | |
virtual void | removeAll () |
Synchronize the state of cache and DB by discarding all kept object (without modifications to DB). | |
void | tryCacheDelete (PersIdentification &persId) |
virtual Cache * | clone () |
Creates a copy of the current cache. |
Supports multithreaded usage. Objects are represented by VoidCacheItem. Instances of that class are stored in a map container provided by STL.
void iopc::VoidCache::clear | ( | ) | [virtual] |
Synchronizes states of the cache and database.
Removes all objects. Makes it possible to harmlessly break association of the cache and its connection.
Implements iopc::Cache.
CacheLock & iopc::VoidCache::makePersistent | ( | const PersIdentification & | persId, | |
DatabaseObject & | objectPtr | |||
) | [virtual] |
Saves an object into database.
Locks it in cache.
persId | ID of the object. | |
obj | Object to be made persistent. |
Implements iopc::Cache.
CacheLock & iopc::VoidCache::getCacheLock | ( | const PersIdentification & | persId, | |
bool | rdonly = false | |||
) | [virtual] |
Assures an object is in cache, locks it and returns an instance making it possible to access the object.
persId | ID of the object. | |
rdonly | Indicates the type of required access to the object (read-only/write). |
Implements iopc::Cache.
void iopc::VoidCache::dbDelete | ( | const PersIdentification & | persId | ) | [virtual] |
void iopc::VoidCache::cacheDelete | ( | const PersIdentification & | persId | ) | [virtual] |
Represents a hint for the cache to remove local copy of an object.
Can be ignored.
persId | ID of the object. |
Implements iopc::Cache.
void iopc::VoidCache::tryCacheDelete | ( | PersIdentification & | persId | ) |
Called when unlocking object lock, tries to remove the object from cache (in case that there are no locks anymore). If succesfully inserted to the database, persId becomes valid and receives generated OID or key values