Loading...
Searching...
No Matches
VdfLRUCache< Key, Value, Hash > Class Template Reference

A simple cache with a fixed capacity and a least-recently-used eviction policy. More...

#include <lruCache.h>

Public Member Functions

 VdfLRUCache (const VdfLRUCache &)=delete
 
VdfLRUCacheoperator= (const VdfLRUCache &)=delete
 
 VdfLRUCache (VdfLRUCache &&)=delete
 
VdfLRUCacheoperator= (VdfLRUCache &&)=delete
 
 VdfLRUCache (size_t capacity)
 Constructs a new cache with a fixed capacity.
 
bool Lookup (const Key &key, Value **value)
 Performs a lookup into the cache and returns true if the cache contains an entry for the given key.
 
void Clear ()
 Removes all entries from the cache.
 

Detailed Description

template<typename Key, typename Value, typename Hash>
class VdfLRUCache< Key, Value, Hash >

A simple cache with a fixed capacity and a least-recently-used eviction policy.

Definition at line 27 of file lruCache.h.

Constructor & Destructor Documentation

◆ VdfLRUCache()

VdfLRUCache ( size_t  capacity)
inlineexplicit

Constructs a new cache with a fixed capacity.

Definition at line 40 of file lruCache.h.

Member Function Documentation

◆ Clear()

void Clear

Removes all entries from the cache.

Definition at line 126 of file lruCache.h.

◆ Lookup()

bool Lookup ( const Key &  key,
Value **  value 
)

Performs a lookup into the cache and returns true if the cache contains an entry for the given key.

If the cache does not contain and entry for key, a new entry will be constructed as long as the cache is below capacity. If the cache has reached capacity an existing entry will be repurposed for key. In this case, value will point at the evicted entry. and the client will be resonpsible for resetting value. In all cases, value will always point at a valid instance of Value.

Definition at line 81 of file lruCache.h.


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