Skip to content

saichethana28/LRU-Cache-Web-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

LRU Cache Web Visualizer

A browser-based visualizer for the Least Recently Used (LRU) Cache algorithm, built with C++, compiled to WebAssembly using Emscripten, and integrated with a responsive HTML/CSS/JavaScript frontend.


🚀 Features

  • ✅ Real-time simulation of put and get operations
  • ✅ Visual feedback for cache state and eviction
  • ✅ WebAssembly-powered performance using native C++ logic
  • ✅ Clear UI with input validation and cache reset option

🧠 How It Works

The LRU cache is implemented in C++ using:

  • std::list for usage order
  • std::unordered_map for O(1) access
  • Exposed to JavaScript via emscripten::bind

Frontend uses:

  • createLRUModule() to load WebAssembly
  • DOM manipulation to render cache state
  • Alert popups for get() results
  • Green boxes to represent cache entries (MRU → LRU)

📸 Demo Walkthrough

1️⃣ Put Operation: Key = 1, Value = A

1_A_put 1_A_display

2️⃣ Put Operation: Key = 2, Value = B

2_B_put 2_B_display

🔍 Get Operation: Key = 1

1_get 1_get_popup

➕ More Inserts: 3:C, 4:D, 5:E, 6:F (Eviction occurs)

3_C_put 3_C_display 4_D_put 4_D_displsay 5_E_put 5_E_display 6_F_put 6_F_display

🧹 Clear Cache

clear_cache_click clear_cache_display


🎥 ## 📽️ Demo Video

Watch the demo


🛠️ Tech Stack

  • C++ — core cache logic
  • Emscripten — compiles C++ to WebAssembly
  • WebAssembly (WASM) — high-performance browser execution
  • HTML/CSS/JS — frontend interface
  • VS Code — development environment


🙌 Author

Sai Chethana Vesireddy
Focused on systems programming, WebAssembly integration, and building interactive visual tools for education and clarity.


⭐️ If you like this project…

  • Star the repo 🌟
  • Fork it 🔱
  • Share your feedback 💬

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors