Poco

template < class TKey, class TValue >

class LRUStrategy

File Information

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

Description

An LRUStrategy implements least recently used cache replacement.

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 KeyIndex::const_iterator ConstIndexIterator;

ConstIterator

typedef typename Keys::const_iterator ConstIterator;

IndexIterator

typedef typename KeyIndex::iterator IndexIterator;

Iterator

typedef typename Keys::iterator Iterator;

KeyIndex

typedef std::map < TKey, Iterator > KeyIndex;

Keys

typedef std::list < TKey > Keys;

Constructors

LRUStrategy inline

LRUStrategy(
    std::size_t size
);

Destructor

~LRUStrategy inline

~LRUStrategy();

Member Functions

onAdd inline

void onAdd(
    const void * param234,
    const KeyValueArgs < TKey, TValue > & args
);

onClear inline

void onClear(
    const void * param237,
    const EventArgs & args
);

onGet inline

void onGet(
    const void * param236,
    const TKey & key
);

onIsValid inline

void onIsValid(
    const void * param238,
    ValidArgs < TKey > & args
);

onRemove inline

void onRemove(
    const void * param235,
    const TKey & key
);

onReplace inline

void onReplace(
    const void * param239,
    std::set < TKey > & elemsToRemove
);

Variables

_keyIndex protected

KeyIndex _keyIndex;

For faster access to _keys

_keys protected

Keys _keys;

_size protected

std::size_t _size;

Number of keys the cache can store.