step20
Loading...
Searching...
No Matches
Public Member Functions | List of all members
step20::least_recently_used::cache< Key, T, Hash, KeyEqual > Class Template Reference

An O(1) algorithm for implementing the LRU cache eviction scheme. More...

#include <least_recently_used.hpp>

Public Member Functions

 cache (std::size_t capacity)
 
 cache (cache &&)=default
 
cacheoperator= (cache &&)=default
 
 cache (const cache &)=delete
 
cacheoperator= (const cache &)=delete
 
virtual ~cache ()=default
 
const T * find (const Key &key)
 
void insert_or_assign (const Key &key, const T &val)
 

Detailed Description

template<class Key, class T, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
class step20::least_recently_used::cache< Key, T, Hash, KeyEqual >

An O(1) algorithm for implementing the LRU cache eviction scheme.

Constructor & Destructor Documentation

◆ cache() [1/3]

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::cache ( std::size_t  capacity)
inlineexplicit

◆ cache() [2/3]

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::cache ( cache< Key, T, Hash, KeyEqual > &&  )
default

◆ cache() [3/3]

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::cache ( const cache< Key, T, Hash, KeyEqual > &  )
delete

◆ ~cache()

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
virtual step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::~cache ( )
virtualdefault

Member Function Documentation

◆ find()

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
const T * step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::find ( const Key &  key)
inline
Returns
nullptr if key is not found

◆ insert_or_assign()

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
void step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::insert_or_assign ( const Key &  key,
const T &  val 
)
inline

Basic exception guarantee. Inserted item remains if an exception occurs.

◆ operator=() [1/2]

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
cache & step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::operator= ( cache< Key, T, Hash, KeyEqual > &&  )
default

◆ operator=() [2/2]

template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
cache & step20::least_recently_used::cache< Key, T, Hash, KeyEqual >::operator= ( const cache< Key, T, Hash, KeyEqual > &  )
delete

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