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 Key
    

    The type of key for looking up a value in the cache.

  • typename Value
    

    The type of value stored in the cache.

  • typename LUtime
    

    The 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 Associativity
    

    The number of entries to store for a given hash value. Use 1 to create a directly mapped cache.

  • auto Depth
    

    The 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.

Aliases

Callbacks and Fields

  • (Key) -> Value load §
    

    The callback function to invoke when a get call 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 key
      

      The key to lookup.

    • cache::set_index_t set_index
      

      The hashed value of the key.