Doxygen
|
#include <cache.h>
Public 类型 | |
using | kv_pair = std::pair< K, V > |
using | iterator = typename std::list< kv_pair >::iterator |
using | const_iterator = typename std::list< kv_pair >::const_iterator |
Public 成员函数 | |
Cache (size_t capacity) | |
creates a cache that can hold capacity elements 更多... | |
V * | insert (const K &key, V &&value) |
Inserts value under key in the cache 更多... | |
V * | insert (const K &key, const V &value) |
Inserts value under key in the cache 更多... | |
void | remove (const K &key) |
Removes entry key from the cache. 更多... | |
V * | find (const K &key) |
Finds a value in the cache given the corresponding key. 更多... | |
size_t | size () const |
Returns the number of values stored in the cache. 更多... | |
size_t | capacity () const |
Returns the maximum number of values that can be stored in the cache. 更多... | |
uint64_t | hits () const |
Returns how many of the find() calls did find a value in the cache. 更多... | |
uint64_t | misses () const |
Returns how many of the find() calls did not found a value in the cache. 更多... | |
void | clear () |
Clears all values in the cache. 更多... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Private 成员函数 | |
void | resize () |
Private 属性 | |
size_t | m_capacity |
std::list< kv_pair > | m_cacheItemList |
std::unordered_map< K, iterator > | m_cacheItemMap |
uint64_t | m_hits =0 |
uint64_t | m_misses =0 |
Fixed size cache for value type V using keys of type K.
When the maximum capacity has reached, the least recently used value is removed from the cache (LRU strategy).
using Cache< K, V >::const_iterator = typename std::list<kv_pair>::const_iterator |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Finds a value in the cache given the corresponding key.
|
inline |
Returns how many of the find() calls did find a value in the cache.
|
inline |
Inserts value under key in the cache
|
inline |
Inserts value under key in the cache
|
inline |
Returns how many of the find() calls did not found a value in the cache.
|
inline |
Removes entry key from the cache.
被这些函数引用 flushCachedTemplateRelations(), flushUnresolvedRelations() , 以及 Cache< std::string, LookupInfo >::insert().
|
inlineprivate |
|
inline |
|
private |
|
private |
|
private |