Home Knowledge Base LRU Cache (Least Recently Used)

LRU Cache (Least Recently Used) is a cache eviction policy that removes the least recently accessed item when the cache reaches its capacity limit. It operates on the principle that items accessed recently are more likely to be accessed again soon — a property called temporal locality.

How LRU Works

Comparison with Other Eviction Policies

LRU in AI/ML Systems

Python Implementation

Python provides functools.lru_cache as a built-in decorator for function-level LRU caching. For distributed systems, Redis supports LRU-style eviction natively.

LRU is the default choice for most caching scenarios due to its simplicity, O(1) performance, and effectiveness across a wide range of access patterns.

lru cache (least recently used)lru cacheleast recently usedoptimization

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.