A Python implementation of a dynamic cache system with LRU (Least Recently Used) and LFU (Least Frequently Used) eviction policies using Doubly Linked Lists and AVL Trees.
- LRU Cache: Implemented using Doubly Linked List (DLL) and HashMap
- LFU Cache: Implemented using AVL Tree for frequency-based eviction
- Menu-driven Interface: Interactive console interface for testing
- Performance Metrics: Tracks hit ratio, miss ratio, and eviction rate
- Write-through Caching: Data consistency between cache and memory
- Doubly Linked List (DLL): For maintaining access order in LRU
- HashMap: For O(1) lookups of cache entries
- AVL Tree: For maintaining frequency counts in LFU
- Integrated Design: DLL + HashMap for efficient cache operations
- get() operation: O(1)
- put() operation: O(1) amortized
- LRU eviction: O(1)
- Cache display: O(n)
# Clone the repository
git clone https://github.com/leena0110/dynamic-cache-system.git
# Navigate to project directory
cd dynamic-cache-system
# Run the cache system
python cache_system.py