![]() |
Public API Reference |
Templated fixed size cache class. More...
#include <csutil/fixedsizecache.h>
Public Member Functions | |
| bool | Get (const K &key, T &data) |
| Get a possibly existing item in cache. | |
| bool | Insert (const K &key, const T &data) |
| Insert an element and key into the cache. | |
| void | InsertOrUpdate (const K &key, const T &data) |
| Update an existing element in the cache, inserting it if needed. | |
| void | Update (const K &key, const T &data) |
| Update an existing element in the cache. | |
Templated fixed size cache class.
The cache can be organized as a 1-way, N-way (where N is a power of two) or fully associative cache.
| K | Key type used to index the cache. Must be hashable and comparable. |
| T | Data type stored in cache. Must be copy-constructable. |
| CacheSize | Number of elements in total in cache |
| Associativity | Associativity of cache. 0 means fully associative. |
| LRUPolicy | Template policy for the per set cache eviction LRU. |
Definition at line 806 of file fixedsizecache.h.
| bool CS::Utility::FixedSizeCache< K, T, CacheSize, Associativity, LRUPolicy, HashFold >::Get | ( | const K & | key, |
| T & | data | ||
| ) | [inline] |
Get a possibly existing item in cache.
| key | Cache item key |
| data | Cached data. Updated on successful retrieval from cache. |
Definition at line 879 of file fixedsizecache.h.
| bool CS::Utility::FixedSizeCache< K, T, CacheSize, Associativity, LRUPolicy, HashFold >::Insert | ( | const K & | key, |
| const T & | data | ||
| ) | [inline] |
Insert an element and key into the cache.
If key already exists, no update will happen
| key | Cache item key |
| data | Cache item data |
Definition at line 826 of file fixedsizecache.h.
| void CS::Utility::FixedSizeCache< K, T, CacheSize, Associativity, LRUPolicy, HashFold >::InsertOrUpdate | ( | const K & | key, |
| const T & | data | ||
| ) | [inline] |
Update an existing element in the cache, inserting it if needed.
| key | Cache item key |
| data | New data for cached item |
Definition at line 861 of file fixedsizecache.h.
| void CS::Utility::FixedSizeCache< K, T, CacheSize, Associativity, LRUPolicy, HashFold >::Update | ( | const K & | key, |
| const T & | data | ||
| ) | [inline] |
Update an existing element in the cache.
If the key is non-existent it will not be added
| key | Cache item key |
| data | New data for cached item |
Definition at line 844 of file fixedsizecache.h.