The Pedigree Project  0.1
Classes | Public Member Functions | Private Attributes | List of all members
LruCache< K, T, Slots > Class Template Reference

LruCache provides a least-recently-used cache abstraction. More...

#include <LruCache.h>

+ Inheritance diagram for LruCache< K, T, Slots >:
+ Collaboration diagram for LruCache< K, T, Slots >:

Classes

struct  Slot
 

Public Member Functions

bool get (const K &key, T &object)
 
void store (const K &key, const T &object)
 
size_t hits () const
 
size_t misses () const
 

Private Attributes

Slot m_Slots [Slots]
 
size_t m_Hits = 0
 
size_t m_Misses = 0
 

Detailed Description

template<class K, class T, size_t Slots = 32>
class LruCache< K, T, Slots >

LruCache provides a least-recently-used cache abstraction.

A key type is used to find items within the cache.

It is recommended that the type T is relatively small and has a low cost to copy (a scalar type is best) for maximum performance.

Definition at line 38 of file LruCache.h.

Member Function Documentation

template<class K, class T, size_t Slots = 32>
bool LruCache< K, T, Slots >::get ( const K &  key,
T &  object 
)
inline

Potentially get an item with the given key.

Definition at line 55 of file LruCache.h.

Referenced by VFS::find(), PosixSubsystem::findFile(), and VFS::lookupFilesystem().

+ Here is the caller graph for this function:

template<class K, class T, size_t Slots = 32>
void LruCache< K, T, Slots >::store ( const K &  key,
const T &  object 
)
inline

Store an item as the most recently used item.

Definition at line 78 of file LruCache.h.

Referenced by VFS::find(), PosixSubsystem::findFile(), and VFS::lookupFilesystem().

+ Here is the caller graph for this function:


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