LRU cache.
More...
#include <sirius/utils/lru_cache.h>
template<typename Key, typename Value, std::size_t CacheSize = 5>
class sirius::utils::LRUCache< Key, Value, CacheSize >
LRU cache.
◆ LRUCache() [1/3]
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ ~LRUCache()
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ LRUCache() [2/3]
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ LRUCache() [3/3]
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ Clear()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Clear all the cache elements.
◆ Contains()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Check that a particular key is present in cache.
- Parameters
-
key | key of the requested element |
- Returns
- true if the element is present in cache
◆ Get()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Get a cache element.
The element fetched will be the new head of the cache
- Parameters
-
key | key of the requested element |
- Returns
- cache element if exists or default constructed element if not
◆ Insert()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Insert an element in the cache.
If the cache size reaches the max size, the last recently used (LRU) element is removed from the cache
- Parameters
-
key | key of the element |
element | element to insert |
◆ operator=() [1/2]
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ operator=() [2/2]
template<typename Key, typename Value, std::size_t CacheSize = 5>
◆ Remove()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Remove an element from the cache.
- Parameters
-
◆ Size()
template<typename Key, typename Value, std::size_t CacheSize = 5>
Get the current size of the cache.
- Returns
- size of the cache
The documentation for this class was generated from the following file: