Library: Foundation
Package: Cache
Header: Poco/UniqueExpireStrategy.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& getExpiration() const;
which returns the absolute timepoint when the entry will be invalidated.
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;
Create an unique expire strategy.
void onAdd(
const void * param234,
const KeyValueArgs < TKey, TValue > & args
);
void onClear(
const void * param237,
const EventArgs & args
);
void onGet(
const void * param236,
const TKey & key
);
void onIsValid(
const void * param238,
ValidArgs < TKey > & args
);
void onRemove(
const void * param235,
const TKey & key
);
void onReplace(
const void * param239,
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