iopc::CacheKeeper Class Reference
[iopclib-cache]

#include <cacheKeeper.h>

List of all members.

Public Member Functions

 CacheKeeper (long minValue=MINLONG, long maxCost=MAXLONG, long costLimit=MAXLONG, bool memCost=false)
ComposedCachesetCache (CachedConnection *conn, const Type &type, Cache *cache)
ComposedCachesetCache (CachedConnection *conn, Cache *cache)
ComposedCachesetStrategy (CachedConnection *conn, const Type &type, bool loadWait, bool loadLocking, UpdatingStrategy uStrat, ReadingStrategy rStrat)
ComposedCachesetStrategy (CachedConnection *conn, bool loadWait, bool loadLocking, UpdatingStrategy uStrat, ReadingStrategy rStrat)
ComposedCachesetStrategy (CachedConnection *conn, const Type &type, const Strategy &strat)
ComposedCachesetStrategy (CachedConnection *conn, const Strategy &strat)
void releaseConnection (CachedConnection *conn)
bool runMaintainer ()
bool stopMaintainer ()

Static Public Member Functions

static void wakeUpMntr (void *instance, long costChange)

Protected Member Functions

bool maintainerStep (const TimeStamp &now, long &sleepTime, long limit)
bool setLimits (long minValue=MINLONG, long maxCost=MAXLONG)
bool imposeCostLimit (long maxCost=MAXLONG)

Static Protected Member Functions

static void * maintainer (void *instance)

Protected Attributes

bool change

Classes

struct  CKRecord


Detailed Description

A class making it easy to manage object caches. Can be used to compose caches, set strategies, run asynchronous maintenance.

Constructor & Destructor Documentation

iopc::CacheKeeper::CacheKeeper ( long  minValue = MINLONG,
long  maxCost = MAXLONG,
long  costLimit = MAXLONG,
bool  memCost = false 
)

Parameters:
minValue Minimal value of objects in managed caches.
maxCost Soft limit of total cost of all caches. Maintained asynchronously.
costLimit Hard limit of total cost of all caches. Maintained synchronously.
memCost Indicates what type of object cost computation should be used (false - count of items, true - size of memory used by all persistent attributes of all objects in all caches).


Member Function Documentation

ComposedCache * iopc::CacheKeeper::setCache ( CachedConnection conn,
const Type type,
Cache cache 
)

Sets cache for specified connection and object type.

Parameters:
conn The connection cache should be set for.
proto the type cache should be set for.
cache The cache to be set.

ComposedCache * iopc::CacheKeeper::setCache ( CachedConnection conn,
Cache cache 
)

Sets cache for specified connection.

Parameters:
conn The connection cache should be set for.
cache The cache to be set.

ComposedCache * iopc::CacheKeeper::setStrategy ( CachedConnection conn,
const Type type,
bool  loadWait,
bool  loadLocking,
UpdatingStrategy  uStrat,
ReadingStrategy  rStrat 
)

Sets strategy for specified connection and object type.

ComposedCache * iopc::CacheKeeper::setStrategy ( CachedConnection conn,
bool  loadWait,
bool  loadLocking,
UpdatingStrategy  uStrat,
ReadingStrategy  rStrat 
)

Sets strategy for specified connection.

ComposedCache * iopc::CacheKeeper::setStrategy ( CachedConnection conn,
const Type type,
const Strategy strat 
)

Sets strategy for specified connection and object type.

ComposedCache * iopc::CacheKeeper::setStrategy ( CachedConnection conn,
const Strategy strat 
)

Sets strategy for specified connection.

void iopc::CacheKeeper::releaseConnection ( CachedConnection conn  ) 

Breaks the mutual assignment of connection and respective composed cache. Release internal structures representing settings for the connection.

void iopc::CacheKeeper::wakeUpMntr ( void *  instance,
long  costChange 
) [static]

Wake up maintainer provided by cache keeper.

bool iopc::CacheKeeper::runMaintainer (  ) 

Run asynchronous maintainer.

bool iopc::CacheKeeper::stopMaintainer (  ) 

Stop asynchronous maintainer.

bool iopc::CacheKeeper::maintainerStep ( const TimeStamp now,
long &  sleepTime,
long  limit 
) [protected]

Executes one maintenance step

Parameters:
sleepTime. Output parameter, the time (in milliseconds) maintainer can sleep for unless it's woken up.
limit. The total cost to be achieved.

void * iopc::CacheKeeper::maintainer ( void *  instance  )  [static, protected]

Main function for asynchronous maintainence thread.

Parameters:
instance (void *)this

bool iopc::CacheKeeper::setLimits ( long  minValue = MINLONG,
long  maxCost = MAXLONG 
) [protected]

Resets limits.

bool iopc::CacheKeeper::imposeCostLimit ( long  maxCost = MAXLONG  )  [protected]

Tries to impose cost limit

Returns:
true on success, false on fail.


Member Data Documentation

bool iopc::CacheKeeper::change [protected]

Container holding connection records.


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

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