data.cache.internal


template <typename Key, typename LUtime, auto Associativity, auto Depth>
class cache_tags §

Handles metadata related to entries in the cache, but does not store data.

Parameters

  • typename Key
    

    The type of key for looking up a value 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, keeping the most recently used values. Pass 1 to create a directly mapped cache.

  • auto Depth
    

    The total number of entries to cache. Must be a multiple of Associativity.

Aliases

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.

  • cache_tags_get_result<cache_tags::entry_index_t, Key>
    get(Key key, cache_tags::set_index_t set_index, bool mark_as_unwritten) §
    

    Get the index of a value from the cache_tags, if present.

    Arguments

    • Key key
      

      The key to lookup.

    • cache_tags::set_index_t set_index
      

      The hashed value of the key.

    • bool mark_as_unwritten
      

      Mark the cache entry as unwritten, meaning it hasn’t been written to the backing store yet.

  • optional<Key>
    get_and_clear_unwritten_key(
        cache_tags::set_index_t set_index,
        cache_tags::entry_index_t entry_index
        ) §
    

    Returns the key at the given (set_index, entry_index) tuple as well as whether the value is unwritten. Marks the key as written. Must not be called concurrently with get.

    Arguments