Class · aurore

aurore::LRUCache

On this page
aurore/core/cache_helper.hpp
#include <aurore/core/cache_helper.hpp>

template <typename K, typename T>
class aurore::LRUCache

Description

LRU cache If the reference count is not 0, the cache will never expire. Cache items with a reference count of 0 are cached according to LRU rules

Types 1

typedef std::list< Node< K, T > >::iterator CacheIter

Constructors 1

LRUCache(size_t c, T defaultValue)

Functions 13

T get(K key)
void set(K key, T value)
void setMemoryBudget(size_t bytes, std::function< size_t(T)> sizeOf)

A budget in bytes, on top of the capacity in entries (0: none). Over it, the least recently used entries nothing holds are freed. sizeOf says what an entry weighs.

cache_helper.hpp:121
size_t getTotalBytes() const
size_t getSize() const
void remove(T value)

It is not really to remove a cache, but to reduce the counter of the corresponding cache by 1

cache_helper.hpp:140
void update(T old_val, T new_val)

Update a cache value

cache_helper.hpp:158
void setCapacity(int c)
void markDirty(T value)

A dirty cache is not able to be hit

Parameters

value
cache_helper.hpp:193
void markAllDirty()
void trimUnused()

Delete all cache entries whose reference count has dropped to zero. Call this after releasing images to promptly free GPU memory.

cache_helper.hpp:226
std::list< Node< K, T > > & getCacheList()
void debug()

Static attributes 2

static size_t DEFAULT_CAPACITY = 400
static bool ALWAYS_CACHE_LOCAL_FILE = true

Read from Aurore's headers by Doxygen at each build · library/include