- CS
- Utility
- Implementation
- FixedSizeCacheSet
![]() |
Public API Reference |
One set in an associative cache. More...
#include <csutil/fixedsizecache.h>
Public Member Functions | |
| ElementType * | Find (const K &key) |
| Find an element with given key in set. | |
| FixedSizeCacheSet () | |
| Initialize an empty cache set. | |
| 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 set. | |
| void | InsertOrUpdate (const K &key, const T &data) |
| Update an existing element in the cache, inserting it if needed. | |
| void | Invalidate (const K &key) |
| Invalidate the data associated with given key, without remving the key itself. | |
| void | Update (const K &key, const T &data) |
| Update an existing element in the set. | |
| ~FixedSizeCacheSet () | |
| Destroy any remaning items in cache set. | |
One set in an associative cache.
Holds a power-of-two number of elements, subject to replacement using a LRU policy.
| K | Key type used to index the cache. Must be hashable and comparable. |
| T | Data type stored in cache. Must be copy-constructable. |
| SetSize | Number of elements in set. |
| LRUPolicy | Template policy for the cache eviction LRU. |
Definition at line 111 of file fixedsizecache.h.
| CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::FixedSizeCacheSet | ( | ) | [inline] |
Initialize an empty cache set.
Definition at line 119 of file fixedsizecache.h.
| CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::~FixedSizeCacheSet | ( | ) | [inline] |
Destroy any remaning items in cache set.
Definition at line 126 of file fixedsizecache.h.
| ElementType* CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::Find | ( | const K & | key | ) | [inline] |
Find an element with given key in set.
| key | Cache item key |
Definition at line 230 of file fixedsizecache.h.
| bool CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::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 251 of file fixedsizecache.h.
| bool CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::Insert | ( | const K & | key, |
| const T & | data | ||
| ) | [inline] |
Insert an element and key into the set.
If key already exists, no update will happen
| key | Cache item key |
| data | Cache item data |
Definition at line 149 of file fixedsizecache.h.
| void CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::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 197 of file fixedsizecache.h.
| void CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::Invalidate | ( | const K & | key | ) | [inline] |
Invalidate the data associated with given key, without remving the key itself.
Definition at line 266 of file fixedsizecache.h.
| void CS::Utility::Implementation::FixedSizeCacheSet< K, T, SetSize, LRUPolicy >::Update | ( | const K & | key, |
| const T & | data | ||
| ) | [inline] |
Update an existing element in the set.
If the key is non-existent it will not be added
| key | Cache item key |
| data | New data for cached item |
Definition at line 175 of file fixedsizecache.h.