teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Classes | Public Member Functions | List of all members
teditor::LRUCache< K, V > Class Template Reference

LRU Cache implementation. More...

#include <lrucache.hpp>

Public Member Functions

 LRUCache (size_t c)
 ctor More...
 
bool exists (const K &k) const
 
size_t capacity () const
 
size_t size () const
 
V & get (const K &k)
 Gets value at the given key and if the key does not exist it returns a default value object. More...
 
void put (const K &k, const V &v)
 

Detailed Description

template<typename K, typename V>
class teditor::LRUCache< K, V >

LRU Cache implementation.

Template Parameters
Kkey type
Vvalue type

Constructor & Destructor Documentation

◆ LRUCache()

template<typename K , typename V >
teditor::LRUCache< K, V >::LRUCache ( size_t  c)
inline

ctor

Parameters
ccapacity of the cache

Member Function Documentation

◆ capacity()

template<typename K , typename V >
size_t teditor::LRUCache< K, V >::capacity ( ) const
inline

◆ exists()

template<typename K , typename V >
bool teditor::LRUCache< K, V >::exists ( const K &  k) const
inline

◆ get()

template<typename K , typename V >
V& teditor::LRUCache< K, V >::get ( const K &  k)
inline

Gets value at the given key and if the key does not exist it returns a default value object.

◆ put()

template<typename K , typename V >
void teditor::LRUCache< K, V >::put ( const K &  k,
const V &  v 
)
inline

puts a new element into the cache

◆ size()

template<typename K , typename V >
size_t teditor::LRUCache< K, V >::size ( ) const
inline

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