Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes
Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL > Class Template Reference

General purpose LRU cache map. Accessing an entry will keep the entry cached. get(const KEY&) and put(const KEY&, const VALUE&) results in an access to the corresponding entry. More...

#include <SimpleLRUCache.h>

+ Inheritance diagram for Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >:

Public Types

typedef std::pair< KEY, VALUE > key_value
 
typedef std::list< key_valuekey_list
 
typedef key_list::const_iterator const_iterator
 
typedef boost::unordered_map< KEY, typename key_list::iterator, HASH, EQUAL > map_type
 
typedef map_type::const_iterator map_iterator
 

Public Member Functions

 SimpleLRUCache (int32_t cacheSize)
 
virtual ~SimpleLRUCache ()
 
void put (const KEY &key, const VALUE &value)
 
VALUE get (const KEY &key)
 
bool contains (const KEY &key) const
 
int32_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Protected Attributes

int32_t cacheSize
 
key_list cacheList
 
map_type cacheMap
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Detailed Description

template<class KEY, class VALUE, class HASH, class EQUAL>
class Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >

General purpose LRU cache map. Accessing an entry will keep the entry cached. get(const KEY&) and put(const KEY&, const VALUE&) results in an access to the corresponding entry.

Member Typedef Documentation

◆ const_iterator

template<class KEY , class VALUE , class HASH , class EQUAL >
typedef key_list::const_iterator Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::const_iterator

◆ key_list

template<class KEY , class VALUE , class HASH , class EQUAL >
typedef std::list< key_value > Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::key_list

◆ key_value

template<class KEY , class VALUE , class HASH , class EQUAL >
typedef std::pair<KEY, VALUE> Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::key_value

◆ map_iterator

template<class KEY , class VALUE , class HASH , class EQUAL >
typedef map_type::const_iterator Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::map_iterator

◆ map_type

template<class KEY , class VALUE , class HASH , class EQUAL >
typedef boost::unordered_map<KEY, typename key_list::iterator, HASH, EQUAL> Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::map_type

Constructor & Destructor Documentation

◆ SimpleLRUCache()

template<class KEY , class VALUE , class HASH , class EQUAL >
Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::SimpleLRUCache ( int32_t  cacheSize)
inline

◆ ~SimpleLRUCache()

template<class KEY , class VALUE , class HASH , class EQUAL >
virtual Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::~SimpleLRUCache ( )
inlinevirtual

Member Function Documentation

◆ begin()

template<class KEY , class VALUE , class HASH , class EQUAL >
const_iterator Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::begin ( ) const
inline

◆ contains()

template<class KEY , class VALUE , class HASH , class EQUAL >
bool Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::contains ( const KEY &  key) const
inline

◆ end()

template<class KEY , class VALUE , class HASH , class EQUAL >
const_iterator Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::end ( ) const
inline

◆ get()

template<class KEY , class VALUE , class HASH , class EQUAL >
VALUE Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::get ( const KEY &  key)
inline

◆ put()

template<class KEY , class VALUE , class HASH , class EQUAL >
void Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::put ( const KEY &  key,
const VALUE &  value 
)
inline

◆ size()

template<class KEY , class VALUE , class HASH , class EQUAL >
int32_t Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::size ( ) const
inline

Field Documentation

◆ cacheList

template<class KEY , class VALUE , class HASH , class EQUAL >
key_list Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::cacheList
protected

◆ cacheMap

template<class KEY , class VALUE , class HASH , class EQUAL >
map_type Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::cacheMap
protected

◆ cacheSize

template<class KEY , class VALUE , class HASH , class EQUAL >
int32_t Lucene::SimpleLRUCache< KEY, VALUE, HASH, EQUAL >::cacheSize
protected

The documentation for this class was generated from the following file:

clucene.sourceforge.net