Library: Foundation
Package: Cache
Header: Poco/ExpireStrategy.h
An ExpireStrategy implements time based expiration of cache entries
Direct Base Classes: AbstractStrategy < TKey, TValue >
All Base Classes: AbstractStrategy < TKey, TValue >
Member Functions: onAdd, onClear, onGet, onIsValid, onRemove, onReplace
typedef typename TimeIndex::const_iterator ConstIndexIterator;
typedef typename TimeIndex::iterator IndexIterator;
typedef typename Keys::iterator Iterator;
typedef std::map < TKey, IndexIterator > Keys;
typedef std::multimap < Timestamp, TKey > TimeIndex;
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.
~ExpireStrategy();
void onAdd(
const void * param125,
const KeyValueArgs < TKey, TValue > & args
);
void onClear(
const void * param128,
const EventArgs & args
);
void onGet(
const void * param127,
const TKey & key
);
void onIsValid(
const void * param129,
ValidArgs < TKey > & args
);
void onRemove(
const void * param126,
const TKey & key
);
void onReplace(
const void * param130,
std::set < TKey > & elemsToRemove
);
Timestamp::TimeDiff _expireTime;
TimeIndex _keyIndex;
Maps time to key value
Keys _keys;
For faster replacement of keys, the iterator points to the _keyIndex map