Library: Foundation
Package: Cache
Header: Poco/ExpireStrategy.h
Description
An ExpireStrategy implements time based expiration of cache entries
Inheritance
Direct Base Classes: AbstractStrategy < TKey, TValue >
All Base Classes: AbstractStrategy < TKey, TValue >
Member Summary
Member Functions: onAdd, onClear, onGet, onIsValid, onRemove, onReplace
Types
ConstIndexIterator
typedef typename TimeIndex::const_iterator ConstIndexIterator;
IndexIterator
typedef typename TimeIndex::iterator IndexIterator;
Iterator
typedef typename Keys::iterator Iterator;
Keys
typedef std::map < TKey, IndexIterator > Keys;
TimeIndex
typedef std::multimap < Timestamp, TKey > TimeIndex;
Constructors
ExpireStrategy
ExpireStrategy(
Timestamp::TimeDiff expireTimeInMilliSec
);
Create an expire strategy. Note that the smallest allowed caching time is 25ms. Anything lower than that is not useful with current operating systems.
Destructor
~ExpireStrategy
~ExpireStrategy();
Member Functions
onAdd
void onAdd(
const void * param252,
const KeyValueArgs < TKey, TValue > & args
);
onClear
void onClear(
const void * param255,
const EventArgs & args
);
onGet
void onGet(
const void * param254,
const TKey & key
);
onIsValid
void onIsValid(
const void * param256,
ValidArgs < TKey > & args
);
onRemove
void onRemove(
const void * param253,
const TKey & key
);
onReplace
void onReplace(
const void * param257,
std::set < TKey > & elemsToRemove
);
Variables
_expireTime
Timestamp::TimeDiff _expireTime;
_keyIndex
TimeIndex _keyIndex;
Maps time to key value
_keys
Keys _keys;
For faster replacement of keys, the iterator points to the _keyIndex map