# Poco

# template < class TKey, class TValue >

# 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 > >

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

## Constructors

### ExpireCache

ExpireCache(
Timestamp::TimeDiff expire = 600000
);

## Destructor

### ~ExpireCache

~ExpireCache();