Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
LRUCache< K, V > Class Template Reference

#include <container.h>

+ Collaboration diagram for LRUCache< K, V >:

Public Member Functions

 LRUCache (size_t limit, void(*cache_miss)(void *data, const K &key, V *dest), void *data)
 
void setLimit (size_t limit)
 
void invalidate ()
 
const V * lookupCache (K key)
 

Private Types

typedef std::template pair< typename std::template list< K >::iterator, V > cache_entry_t
 
typedef std::template map< K, cache_entry_tcache_type
 

Private Attributes

void(* m_cache_miss )(void *data, const K &key, V *dest)
 
void * m_cache_miss_data
 
size_t m_limit
 
cache_type m_map
 
std::list< K > m_queue
 

Member Typedef Documentation

◆ cache_entry_t

template<typename K , typename V >
typedef std::template pair<typename std::template list<K>::iterator, V> LRUCache< K, V >::cache_entry_t
private

◆ cache_type

template<typename K , typename V >
typedef std::template map<K, cache_entry_t> LRUCache< K, V >::cache_type
private

Constructor & Destructor Documentation

◆ LRUCache()

template<typename K , typename V >
LRUCache< K, V >::LRUCache ( size_t limit,
void(* cache_miss )(void *data, const K &key, V *dest),
void * data )
inline

Member Function Documentation

◆ invalidate()

template<typename K , typename V >
void LRUCache< K, V >::invalidate ( )
inline

References LRUCache< K, V >::m_map, and LRUCache< K, V >::m_queue.

Referenced by AreaStore::invalidateCache(), and LRUCache< K, V >::setLimit().

+ Here is the caller graph for this function:

◆ lookupCache()

template<typename K , typename V >
const V * LRUCache< K, V >::lookupCache ( K key)
inline

References LRUCache< K, V >::m_cache_miss, LRUCache< K, V >::m_cache_miss_data, LRUCache< K, V >::m_limit, LRUCache< K, V >::m_map, and LRUCache< K, V >::m_queue.

Referenced by AreaStore::getAreasForPos().

+ Here is the caller graph for this function:

◆ setLimit()

template<typename K , typename V >
void LRUCache< K, V >::setLimit ( size_t limit)
inline

References LRUCache< K, V >::invalidate(), and LRUCache< K, V >::m_limit.

Referenced by AreaStore::setCacheParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cache_miss

template<typename K , typename V >
void(* LRUCache< K, V >::m_cache_miss) (void *data, const K &key, V *dest)
private

◆ m_cache_miss_data

template<typename K , typename V >
void* LRUCache< K, V >::m_cache_miss_data
private

◆ m_limit

template<typename K , typename V >
size_t LRUCache< K, V >::m_limit
private

◆ m_map

template<typename K , typename V >
cache_type LRUCache< K, V >::m_map
private

◆ m_queue

template<typename K , typename V >
std::list<K> LRUCache< K, V >::m_queue
private

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