HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VdfLRUCache< Key, Value, Hash > Class Template Reference

#include <lruCache.h>

Public Member Functions

 VdfLRUCache (const VdfLRUCache &)=delete
 
VdfLRUCacheoperator= (const VdfLRUCache &)=delete
 
 VdfLRUCache (VdfLRUCache &&)=delete
 
VdfLRUCacheoperator= (VdfLRUCache &&)=delete
 
 VdfLRUCache (size_t capacity)
 
bool Lookup (const Key &key, Value **value)
 
void Clear ()
 

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

template<typename Key, typename Value, typename Hash>
VdfLRUCache< Key, Value, Hash >::VdfLRUCache ( const VdfLRUCache< Key, Value, Hash > &  )
delete
template<typename Key, typename Value, typename Hash>
VdfLRUCache< Key, Value, Hash >::VdfLRUCache ( VdfLRUCache< Key, Value, Hash > &&  )
delete
template<typename Key, typename Value, typename Hash>
VdfLRUCache< Key, Value, Hash >::VdfLRUCache ( size_t  capacity)
inlineexplicit

Constructs a new cache with a fixed capacity.

Definition at line 40 of file lruCache.h.

Member Function Documentation

template<typename Key , typename Value , typename Hash >
void VdfLRUCache< Key, Value, Hash >::Clear ( )

Removes all entries from the cache.

Definition at line 126 of file lruCache.h.

template<typename Key, typename Value, typename Hash >
bool VdfLRUCache< Key, Value, Hash >::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.

template<typename Key, typename Value, typename Hash>
VdfLRUCache& VdfLRUCache< Key, Value, Hash >::operator= ( const VdfLRUCache< Key, Value, Hash > &  )
delete
template<typename Key, typename Value, typename Hash>
VdfLRUCache& VdfLRUCache< Key, Value, Hash >::operator= ( VdfLRUCache< Key, Value, Hash > &&  )
delete

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