#include <cache.h>
Public Member Functions | |
virtual void | setConnection (Connection *conn=NULL) |
Sets the connection associated with cache. | |
virtual void | clear ()=0 |
Synchronizes states of the cache and database. | |
virtual CacheLock & | makePersistent (const PersIdentification &persId, DatabaseObject &objectPtr)=0 |
Saves an object into database. | |
virtual CacheLock & | getCacheLock (const PersIdentification &persId, bool rdonly=false)=0 |
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)=0 |
Deletes an object. | |
virtual void | cacheDelete (const PersIdentification &persId)=0 |
Represents a hint for the cache to remove local copy of an object. | |
virtual void | updateDirty ()=0 |
Synchronize the state of cache and DB by updating the DB. | |
virtual void | removeAll ()=0 |
Synchronize the state of cache and DB by discarding all kept object (without modifications to DB). | |
virtual Cache * | clone ()=0 |
Creates a copy of the current cache. | |
Protected Attributes | |
Connection * | conn |
void iopc::Cache::setConnection | ( | Connection * | conn = NULL |
) | [inline, virtual] |
Sets the connection associated with cache.
conn | The connection. |
Reimplemented in iopc::ComposedCache, and iopc::FakeExtendedCache.
virtual void iopc::Cache::clear | ( | ) | [pure virtual] |
Synchronizes states of the cache and database.
Removes all objects. Makes it possible to harmlessly break association of the cache and its connection.
Implemented in iopc::ComposedCache, iopc::ExtendedCache, iopc::FakeExtendedCache, and iopc::VoidCache.
virtual CacheLock& iopc::Cache::makePersistent | ( | const PersIdentification & | persId, | |
DatabaseObject & | objectPtr | |||
) | [pure virtual] |
Saves an object into database.
Locks it in cache.
persId | ID of the object. | |
obj | Object to be made persistent. |
Implemented in iopc::ComposedCache, iopc::ExtendedCache, and iopc::VoidCache.
virtual CacheLock& iopc::Cache::getCacheLock | ( | const PersIdentification & | persId, | |
bool | rdonly = false | |||
) | [pure 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). |
Implemented in iopc::ComposedCache, iopc::ExtendedCache, and iopc::VoidCache.
virtual void iopc::Cache::dbDelete | ( | const PersIdentification & | persId | ) | [pure virtual] |
Deletes an object.
persId | ID of the object. |
Implemented in iopc::ComposedCache, iopc::ExtendedCache, iopc::FakeExtendedCache, and iopc::VoidCache.
virtual void iopc::Cache::cacheDelete | ( | const PersIdentification & | persId | ) | [pure virtual] |
Represents a hint for the cache to remove local copy of an object.
Can be ignored.
persId | ID of the object. |
Implemented in iopc::ComposedCache, iopc::ExtendedCache, iopc::FakeExtendedCache, and iopc::VoidCache.
Connection* iopc::Cache::conn [protected] |
A connection associated with the cache.