Collage  0.6.1
Classes | Public Member Functions
co::InstanceCache Class Reference

List of all members.

Classes

struct  Data
 One cache entry. More...
struct  Item

Public Member Functions

CO_API InstanceCache (const uint64_t maxSize=LB_100MB)
 Construct a new instance cache.
CO_API ~InstanceCache ()
 Destruct this instance cache.
CO_API bool add (const ObjectVersion &rev, const uint32_t instanceID, Command &command, const uint32_t usage=0)
 Add a new command to the instance cache.
void remove (const NodeID &node)
 Remove all items from the given node.
CO_API const Dataoperator[] (const UUID &id)
 Direct access to the cached instance data for the given object id.
CO_API bool release (const UUID &id, const uint32_t count)
 Release the retrieved instance data of the given object.
CO_API bool erase (const UUID &id)
 Erase all the data for the given object.
uint64_t getSize () const
uint64_t getMaxSize () const
void expire (const int64_t age)
 Remove all items which are older than the given time.
bool isEmpty ()

Detailed Description

Definition at line 36 of file instanceCache.h.


Constructor & Destructor Documentation

CO_API co::InstanceCache::InstanceCache ( const uint64_t  maxSize = LB_100MB)

Construct a new instance cache.

Destruct this instance cache.


Member Function Documentation

CO_API bool co::InstanceCache::add ( const ObjectVersion rev,
const uint32_t  instanceID,
Command command,
const uint32_t  usage = 0 
)

Add a new command to the instance cache.

Parameters:
revthe object identifier and version.
instanceIDthe master instance ID.
commandThe command to add.
usagepre-set usage count.
Returns:
true if the command was entered, false if not.
CO_API bool co::InstanceCache::erase ( const UUID &  id)

Erase all the data for the given object.

The data does not have to be accessed, i.e., release has been called for each previous access.

Returns:
true if the element was erased, false otherwise.
void co::InstanceCache::expire ( const int64_t  age)

Remove all items which are older than the given time.

uint64_t co::InstanceCache::getMaxSize ( ) const [inline]
Returns:
the maximum number of bytes used by the instance cache.

Definition at line 110 of file instanceCache.h.

uint64_t co::InstanceCache::getSize ( ) const [inline]
Returns:
the number of bytes used by the instance cache.

Definition at line 107 of file instanceCache.h.

CO_API const Data& co::InstanceCache::operator[] ( const UUID &  id)

Direct access to the cached instance data for the given object id.

The instance data for the given object has to be released by the caller, unless 0 has been returned. Not all returned data stream might be ready.

Parameters:
idthe identifier of the object to look up.
Returns:
the list of cached instance datas, or Data::NONE if no data is cached for this object.
CO_API bool co::InstanceCache::release ( const UUID &  id,
const uint32_t  count 
)

Release the retrieved instance data of the given object.

Parameters:
idthe identifier of the object to release.
countthe number of access operations to release
Returns:
true if the element was unpinned, false if it is not in the instance cache.
void co::InstanceCache::remove ( const NodeID node)

Remove all items from the given node.


The documentation for this class was generated from the following file:
Generated on Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1