Skip to content

09shivam/lru_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 LRU Cache CLI Visualizer (C++)

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.

πŸ›  Features

  • put <key> <value> β†’ Insert or update
  • get <key> β†’ Retrieve value
  • show β†’ View current cache state
  • stats β†’ Hit/miss stats with live progress bar
  • exit β†’ End the session

πŸ“Έ Demo

🧠 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% [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ------------------------]

πŸ”§ Build Instructions

cd src/ g++ -o ../build/lrucache main.cpp LRUCache.cpp cd ../build ./lrucache

πŸ“¦ Requirements

  • C++11 or above
  • g++ / clang++
  • Linux/macOS/Windows (Terminal)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages