Expand description
§Cache Implementation Details
The cache is implemented as a combination of:
- A
HashMap
for O(1) key lookups - A vector-based ordered collection for managing the eviction order
- A “visited” flag on each entry to track recent access
When the cache is full and a new item is inserted, the eviction algorithm:
- Starts from the “hand” position (eviction candidate)
- Finds the first non-visited entry, evicting it
- Marks all visited entries as non-visited while searching