Library: Foundation
Package: Cache
Header: Poco/UniqueAccessExpireStrategy.h
An UniqueExpireStrategy implements time based expiration of cache entries. In contrast to ExpireStrategy which only allows to set a per cache expiration value, it allows to define expiration per CacheEntry. Each TValue object must thus offer the following method:
const Poco::Timestamp& getTimeout() const;
which returns the timespan for how long an object will be valid without being accessed.
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::pair < TKey, Timespan > KeyExpire;
typedef std::map < TKey, IndexIterator > Keys;
typedef std::multimap < Timestamp, KeyExpire > TimeIndex;
Create an unique expire strategy.
~UniqueAccessExpireStrategy();
void onAdd(
const void * param228,
const KeyValueArgs < TKey, TValue > & args
);
void onClear(
const void * param231,
const EventArgs & args
);
void onGet(
const void * param230,
const TKey & key
);
void onIsValid(
const void * param232,
ValidArgs < TKey > & args
);
void onRemove(
const void * param229,
const TKey & key
);
void onReplace(
const void * param233,
std::set < TKey > & elemsToRemove
);
TimeIndex _keyIndex;
Maps time to key value
Keys _keys;
For faster replacement of keys, the iterator points to the _keyIndex map