IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
IMP::LRUCache< Generator, Checker > Class Template Reference

Implement a simple least recently used cache. More...

#include <IMP/cache.h>

Detailed Description

template<class Generator, class Checker = std::equal_to<typename Generator::result_type>>
class IMP::LRUCache< Generator, Checker >

Implement a simple least recently used cache.

As with the Memoizer, it is parameterized by a generator that is used to generate values if they are not in the cache.

The Generator should have a method:

  • Generator::operator()(Key, Cache);

Definition at line 254 of file cache.h.

Public Types

typedef OrderIterator ContentIterator
 
typedef Generator::argument_type Key
 
typedef Generator::result_type Value
 

Public Member Functions

 LRUCache (const Generator &gen, unsigned int size, const Checker checker=Checker())
 
Generator & access_generator ()
 
ContentIterator contents_begin () const
 
ContentIterator contents_end () const
 
Value get (const Key &k) const
 
const Generator & get_generator () const
 
double get_hit_rate () const
 
Vector< Key > get_keys () const
 
void insert (Key k, Value v)
 
unsigned int size () const
 

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