data.cache.read_only ≡
template < typename Key, typename Value, typename LUtime, auto Associativity, auto Depth, auto Banks = 1 > class cache §
Read-only cache.
Parameters
-
typename KeyThe type of key for looking up a value in the cache.
-
typename ValueThe type of value stored in the cache.
-
typename LUtimeThe type to use for storing the time a cache entry was most recently used. Using a wider type makes LRU eviction more accurate for a set associative cache, but for a direct cache where LRU does not apply, using uint1 saves space.
-
auto AssociativityThe number of entries to store for a given hash value. Use 1 to create a directly mapped cache.
-
auto DepthThe total number of entries to cache. Must be a multiple of
Associativity. -
auto Banks = 1
The number of memories used to implement the data store. Higher values makes of large caches placement easier.
Callbacks and Fields
-
(Key) -> Value load §
The callback function to invoke when a
getcall causes a cache miss.
Methods
-
void initialize() §
Initialize or re-initialize a cache object. Re-initializing the cache invalidates all entries. The caller must ensure that intialize is not called concurrently with
get. -
Value get(Key key, cache::set_index_t set_index) §
Get a value from the cache.
Arguments
-
Key keyThe key to lookup.
-
cache::set_index_t set_index
The hashed value of the key.
-