Module _cache_implementation

Source
Expand description

§Cache Implementation Details

The cache is implemented as a combination of:

  1. A HashMap for O(1) key lookups
  2. A vector-based ordered collection for managing the eviction order
  3. A “visited” flag on each entry to track recent access

When the cache is full and a new item is inserted, the eviction algorithm:

  1. Starts from the “hand” position (eviction candidate)
  2. Finds the first non-visited entry, evicting it
  3. Marks all visited entries as non-visited while searching