File Information
Library: Foundation
Package: Cache
Header: Poco/UniqueExpireStrategy.h
Description
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.
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
UniqueExpireStrategy
Create an unique expire strategy.
Destructor
~UniqueExpireStrategy
Member Functions
onAdd
void onAdd(
const void * param430,
const KeyValueArgs < TKey, TValue > & args
);
onClear
void onClear(
const void * param433,
const EventArgs & args
);
onGet
void onGet(
const void * param432,
const TKey & key
);
onIsValid
void onIsValid(
const void * param434,
ValidArgs < TKey > & args
);
onRemove
void onRemove(
const void * param431,
const TKey & key
);
onReplace
void onReplace(
const void * param435,
std::set < TKey > & elemsToRemove
);
Variables
_keyIndex
TimeIndex _keyIndex;
Maps time to key value
_keys
Keys _keys;
For faster replacement of keys, the iterator points to the _keyIndex map