Skip to content
Veltoryx Technologies

Cache Sizing & Eviction Simulator (LRU, LFU, FIFO)

Interactive step-by-step visualizer for cache replacement policies (LRU, LFU, FIFO). Observe real-time hit/miss rates, memory state transitions, and item evictions.

Runs in your browser. Nothing is uploaded.
Cache Slots (Capacity):3 items
Presets:·
Total Accesses12
Cache Hits2
Cache Misses10
Hit Ratio16.7%

Step-by-Step Cache Memory Progression

StepRequestResultEvictedCache State (Left: Oldest $\rightarrow$ Right: MRU)
#1AMISS—
A
#2BMISS—
AB
#3CMISS—
ABC
#4DMISSEvicted "A"
BCD
#5AMISSEvicted "B"
CDA
#6BMISSEvicted "C"
DAB
#7EMISSEvicted "D"
ABE
#8AHIT—
BEA
#9BHIT—
EAB
#10CMISSEvicted "E"
ABC
#11DMISSEvicted "A"
BCD
#12EMISSEvicted "B"
CDE

How to use this tool

1
Select eviction algorithm

Choose LRU (Least Recently Used), LFU (Least Frequently Used), or FIFO (First In First Out).

2
Set cache slots and access sequence

Pick cache capacity (2 to 6 slots) and enter a comma-separated stream of key accesses.

3
Trace memory state progression

Follow the execution table to see exact cache hits, misses, and which item was evicted at each step.

Frequently Asked Questions

How is an LRU cache implemented in software?

LRU caches are typically implemented using a Doubly-Linked List combined with a Hash Map (O(1) lookup and O(1) node relocation to head upon access). In Java, LinkedHashMap(capacity, loadFactor, true) provides built-in LRU ordering.

What is the difference between LRU and LFU?

LRU evicts the item that has not been accessed for the longest time. LFU tracks an access counter per item and evicts the item with the lowest historical frequency, which prevents sudden one-off scans from polluting the cache.

What is Belady's Anomaly in FIFO caching?

Belady's Anomaly is a counter-intuitive phenomenon where increasing the cache capacity in FIFO replacement actually increases the number of cache misses for certain access patterns.

Which cache eviction algorithm does Redis use?

Redis implements approximated LRU, approximated LFU, volatile-lru (expiring keys only), and allkeys-random. Approximated LRU samples a small set of keys (e.g. 5) and evicts the best candidate, saving memory over maintaining explicit pointer lists.

📖 Related Lessons on Veltoryx Learn

Deepen your architecture knowledge with practical, production-tested guides:

Client-Side Privacy Guarantee

This tool never transmits your payloads to any server. Open DevTools (F12) → Network tab to verify that zero HTTP requests are sent while using this page.

🛡 Safe for confidential enterprise payloads