7#ifndef SIMPLELRUCACHE_H
8#define SIMPLELRUCACHE_H
18template <
class KEY,
class VALUE,
class HASH,
class EQUAL>
24 typedef boost::unordered_map<KEY, typename key_list::iterator, HASH, EQUAL>
map_type;
40 void put(
const KEY& key,
const VALUE& value) {
41 cacheList.push_front(std::make_pair(key, value));
50 VALUE
get(
const KEY& key) {
56 VALUE value(find->second->second);
58 cacheList.push_front(std::make_pair(key, value));
Base class for all Lucene classes.
Definition LuceneObject.h:31
General purpose LRU cache map. Accessing an entry will keep the entry cached. get(const KEY&) and put...
Definition SimpleLRUCache.h:19
key_list::const_iterator const_iterator
Definition SimpleLRUCache.h:23
void put(const KEY &key, const VALUE &value)
Definition SimpleLRUCache.h:40
int32_t size() const
Definition SimpleLRUCache.h:68
map_type cacheMap
Definition SimpleLRUCache.h:37
map_type::const_iterator map_iterator
Definition SimpleLRUCache.h:25
key_list cacheList
Definition SimpleLRUCache.h:36
std::pair< KEY, VALUE > key_value
Definition SimpleLRUCache.h:21
bool contains(const KEY &key) const
Definition SimpleLRUCache.h:64
const_iterator end() const
Definition SimpleLRUCache.h:76
boost::unordered_map< KEY, typename key_list::iterator, HASH, EQUAL > map_type
Definition SimpleLRUCache.h:24
std::list< key_value > key_list
Definition SimpleLRUCache.h:22
const_iterator begin() const
Definition SimpleLRUCache.h:72
SimpleLRUCache(int32_t cacheSize)
Definition SimpleLRUCache.h:27
virtual ~SimpleLRUCache()
Definition SimpleLRUCache.h:31
VALUE get(const KEY &key)
Definition SimpleLRUCache.h:50
int32_t cacheSize
Definition SimpleLRUCache.h:35
Definition AbstractAllTermDocs.h:12