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) |
ComposedCache * | setCache (CachedConnection *conn, const Type &type, Cache *cache) |
ComposedCache * | setCache (CachedConnection *conn, Cache *cache) |
ComposedCache * | setStrategy (CachedConnection *conn, const Type &type, bool loadWait, bool loadLocking, UpdatingStrategy uStrat, ReadingStrategy rStrat) |
ComposedCache * | setStrategy (CachedConnection *conn, bool loadWait, bool loadLocking, UpdatingStrategy uStrat, ReadingStrategy rStrat) |
ComposedCache * | setStrategy (CachedConnection *conn, const Type &type, const Strategy &strat) |
ComposedCache * | setStrategy (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
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. |
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.
Sets strategy for specified connection and object type.
Sets strategy for specified connection.
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:
-
bool iopc::CacheKeeper::setLimits |
( |
long |
minValue = MINLONG , |
|
|
long |
maxCost = MAXLONG | |
|
) |
| | [protected] |
bool iopc::CacheKeeper::imposeCostLimit |
( |
long |
maxCost = MAXLONG |
) |
[protected] |
Tries to impose cost limit
- Returns:
- true on success, false on fail.
Member Data Documentation
Container holding connection records.
The documentation for this class was generated from the following files: