Poco

template < class TKey, class TValue, class TMutex = FastMutex, class TEventMutex = FastMutex >

class ExpireCache

Library: Foundation
Package: Cache
Header: Poco/ExpireCache.h

Description

An ExpireCache caches entries for a fixed time period (per default 10 minutes). Entries expire independently of the access pattern, i.e. after a constant time. If you require your objects to expire after they were not accessed for a given time period use a Poco::AccessExpireCache.

Be careful when using an ExpireCache. A cache is often used like cache.has(x) followed by cache.get x). Note that it could happen that the "has" call works, then the current execution thread gets descheduled, time passes, the entry gets invalid, thus leading to an empty SharedPtr being returned when "get" is invoked.

Inheritance

Direct Base Classes: AbstractCache < TKey, TValue, ExpireStrategy < TKey, TValue >, TMutex, TEventMutex >

All Base Classes: AbstractCache < TKey, TValue, ExpireStrategy < TKey, TValue >, TMutex, TEventMutex >

Constructors

ExpireCache inline

ExpireCache(
    Timestamp::TimeDiff expire = 600000
);

Destructor

~ExpireCache inline

~ExpireCache();