A terminal-based Least Recently Used (LRU) Cache simulator built in C++. Features a command-line interface with live stats and a hit ratio progress bar.
put <key> <value>β Insert or updateget <key>β Retrieve valueshowβ View current cache statestatsβ Hit/miss stats with live progress barexitβ End the session
π§ Welcome to the LRU Cache CLI Visualizer!
Enter cache capacity: 3
π put 1 100
π put 2 200
π get 1
π Value: 100
π put 3 300
π put 4 400
π show
[4:400] β [3:300] β [1:100]
π stats
π Cache Stats:
Total Ops : 5
Hits : 1
Misses : 0
Evictions : 1
Hit Ratio : 20.00% [ββββββ------------------------]cd src/ g++ -o ../build/lrucache main.cpp LRUCache.cpp cd ../build ./lrucache
- C++11 or above
- g++ / clang++
- Linux/macOS/Windows (Terminal)