iopc::VoidCache Class Reference
[iopclib-cache]

Simple cache implementation removing objects as soon as possible (immediately after unlocking last lock). More...

#include <voidCache.h>

Inheritance diagram for iopc::VoidCache:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void clear ()
 Synchronizes states of the cache and database.
virtual CacheLockmakePersistent (const PersIdentification &persId, DatabaseObject &objectPtr)
 Saves an object into database.
virtual CacheLockgetCacheLock (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 Cacheclone ()
 Creates a copy of the current cache.


Detailed Description

Simple cache implementation removing objects as soon as possible (immediately after unlocking last lock).

Supports multithreaded usage. Objects are represented by VoidCacheItem. Instances of that class are stored in a map container provided by STL.


Member Function Documentation

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.

Parameters:
persId ID of the object.
obj Object to be made persistent.
Returns:
An instance representing locked object and making it possible to read and modify the object.

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.

Parameters:
persId ID of the object.
rdonly Indicates the type of required access to the object (read-only/write).
Returns:
An instance making it possible to access the object.

Implements iopc::Cache.

void iopc::VoidCache::dbDelete ( const PersIdentification persId  )  [virtual]

Deletes an object.

Parameters:
persId ID of the object.

Implements iopc::Cache.

void iopc::VoidCache::cacheDelete ( const PersIdentification persId  )  [virtual]

Represents a hint for the cache to remove local copy of an object.

Can be ignored.

Parameters:
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


The documentation for this class was generated from the following files:

Generated on Tue Apr 14 16:46:47 2009 for IOPC 2 by  doxygen 1.5.6