A cache eviction policy is the deterministic algorithm that governs which data item is removed when a cache reaches its storage capacity and a new item must be inserted. The policy's objective is to maximize the cache hit ratio by retaining items with the highest probability of future access. Common strategies include Least Recently Used (LRU), which discards the item with the oldest access timestamp, and Least Frequently Used (LFU), which tracks access counts to identify cold data.
Glossary
Cache Eviction Policy

What is Cache Eviction Policy?
A cache eviction policy is an algorithm that determines which data to remove from a full cache to make space for new content, optimizing for future hit ratios.
Advanced variants like LRU-K improve precision by considering the timestamp of the K-th most recent reference, distinguishing between frequently and sporadically accessed objects. In proactive caching for AI-enhanced RANs, eviction policies must also account for content freshness and predicted mobility patterns, balancing temporal locality with the cost of backhaul retrieval to ensure seamless edge delivery.
Core Characteristics of Eviction Policies
The algorithmic logic that governs which data is discarded when a cache reaches its capacity limit, directly impacting hit ratios and system performance.
The Recency vs. Frequency Trade-off
Eviction policies must balance two competing signals:
- Recency: How recently was the data accessed? (e.g., LRU)
- Frequency: How often is the data accessed? (e.g., LFU)
Pure LRU is vulnerable to cache pollution from sequential scans that evict frequently-used hot items. LRU-K bridges this gap by tracking the timestamp of the last K references, effectively filtering out one-hit wonders while retaining genuinely popular content. This is critical in Content Delivery Networks where a viral video segment exhibits high frequency, while a one-time DNS lookup only shows recency.
TTL-Based Invalidation
A time-to-live (TTL) is an explicit expiration timestamp assigned to each cached object. Unlike capacity-driven eviction, TTL enforces content freshness by removing data that has exceeded its validity period, regardless of access patterns.
- Absolute TTL: Object expires at a fixed wall-clock time (e.g., a stock price valid for 15 minutes).
- Sliding TTL: Expiration resets on each access, keeping frequently-read data alive.
In MEC Caching for autonomous vehicles, stale sensor data must be evicted aggressively using short TTLs to prevent decisions based on outdated environmental models.
Cost-Aware Eviction
Advanced policies incorporate the latency penalty of a cache miss to prioritize eviction candidates. The algorithm calculates a value score, often defined as:
Score = (Fetch Cost × Frequency) / Size
- Fetch Cost: The round-trip time to retrieve the object from the origin server.
- Size: Larger objects consume more cache slots, so size-aware policies like GDStar optimize for byte-hit ratio rather than object-hit ratio.
This is essential in Joint Caching and Computing scenarios where evicting a pre-computed inference result could trigger an expensive GPU-bound recomputation.
Approximate LRU with Sampling
Exact LRU requires maintaining a global doubly-linked list, which introduces lock contention in high-throughput, multi-threaded caches like Redis. Production systems often use approximate eviction:
- Redis Allkeys-LRU: Samples N random keys and evicts the least recently used among the sample.
- Clock (Second Chance): A circular buffer with a reference bit. The algorithm scans for an unreferenced page, clearing bits as it goes.
These approximations achieve near-LRU performance with O(1) complexity per eviction, critical for Edge Pre-fetching nodes handling millions of requests per second.
Segmented and Multi-Tier Eviction
Modern caches partition storage into segments with distinct eviction policies to prevent destructive interference between workload types:
- Segmented LRU (SLRU): Uses a probationary segment for new entries and a protected segment for items accessed at least twice. Eviction occurs only from the probationary segment.
- TinyLFU: A frequency sketch (Count-Min Sketch) filters infrequent items before they enter the main cache, providing near-optimal hit ratios with minimal memory overhead.
This architecture underpins Caffeine, the high-performance Java caching library used in Apache Kafka and Apache Cassandra.
Machine Learning-Driven Eviction
Learned policies use neural networks to predict an object's future reuse distance, replacing hand-crafted heuristics:
- Feature Engineering: Inputs include access frequency, recency, object size, content type, and temporal patterns (e.g., time of day).
- LSTM-Based Predictors: Recurrent networks model sequential access patterns to forecast if an object will be requested again within a lookahead window.
In Proactive Caching for video streaming, an ML model can predict that a specific video tile will not be revisited, preemptively evicting it to make room for predicted popular content from a Content Popularity Prediction engine.
Comparison of Common Eviction Policies
A technical comparison of algorithmic strategies for selecting which cache entry to discard when the cache is full and new data must be inserted.
| Feature | LRU | LFU | LRU-K |
|---|---|---|---|
Core Mechanism | Discards the least recently accessed item based on a single recency timestamp | Discards the item with the lowest total access frequency count | Discards the item whose K-th most recent access is oldest, using a backward K-distance metric |
Primary Metric | Recency of last access | Cumulative access count | Inter-arrival time of last K references |
Handles Bursty Traffic | |||
Resistant to Scan Pollution | |||
Memory Overhead | Low (doubly-linked list + hash map) | Low (frequency counter per entry) | Moderate (K history timestamps per entry) |
Computational Complexity | O(1) per access | O(log N) with heap; O(1) with approximate LFU | O(log N) for priority queue maintenance |
Correlated Reference Pattern Performance | Excellent for temporal locality | Poor; frequency bias ignores recency | Excellent; captures long-term correlation |
Cold Start Sensitivity | Low; new items placed at MRU position | High; new items with low frequency evicted quickly | Low; uses last K references to establish pattern |
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the algorithms that determine which data gets removed when a cache reaches its storage capacity.
A cache eviction policy is a deterministic algorithm that selects which data item to remove from a full cache to make space for a new entry. The policy operates by evaluating a specific metric for each cached object—such as recency of access, frequency of requests, or a cost function—and evicting the item with the lowest score. When the cache reaches its configured capacity threshold, the eviction algorithm executes atomically: it identifies the victim entry, invalidates it, writes the new data block into the freed space, and updates the cache metadata index. The choice of policy directly impacts the cache hit ratio, which is the percentage of requests served from cache without requiring a fetch from the origin server. In content delivery networks and edge computing environments, the eviction policy runs continuously on every SET operation, making its computational efficiency as critical as its predictive accuracy.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Cache eviction policies operate within a broader ecosystem of caching strategies. These related concepts define how content is selected, validated, and delivered at the network edge.
Cache Hit Ratio
A key performance indicator measuring the percentage of content requests successfully served from a cache versus those requiring retrieval from the origin server. A high hit ratio directly correlates with reduced latency and backhaul offloading.
- Formula:
Hits / (Hits + Misses) × 100 - Impact: A 1% improvement in hit ratio can reduce origin traffic by 5-10% in large CDNs
- Relationship to eviction: The eviction policy directly determines which items remain available, making it the primary lever for optimizing this metric
Content Freshness
A metric ensuring that cached data remains valid and consistent with the origin server, often managed through TTL-Based Invalidation mechanisms. Stale content violates correctness guarantees and can propagate outdated information to end users.
- TTL (Time-To-Live): An explicit expiration timestamp assigned by the origin server
- Stale-While-Revalidate: Serves stale content immediately while asynchronously refreshing in the background
- Eviction interaction: Freshness constraints may override eviction policy decisions, forcing removal of valid-but-expired entries before the algorithm would naturally evict them
Temporal Locality
The principle that recently requested content is likely to be requested again soon, a foundational concept for designing effective caching algorithms. This observation underpins the entire LRU (Least Recently Used) family of eviction policies.
- Real-world example: Breaking news articles receive 90% of their total traffic within the first 6 hours of publication
- LRU-K extension: Tracks the time of the last K references rather than just the most recent one, filtering out one-hit wonders that pollute the cache
- Counter-example: Some workloads exhibit scanning patterns where temporal locality breaks down entirely
Zipf's Law
A probability distribution commonly used to model content popularity in networks, stating that the frequency of a request is inversely proportional to its rank. The most popular item is requested roughly twice as often as the second most popular, three times as often as the third, and so on.
- Formula:
f(k) ∝ 1/k^swhere s is the skew parameter (typically ~1) - Implication: A small fraction of content (the head) generates the majority of traffic, making eviction of tail items relatively safe
- Cache sizing: Zipfian distributions mean that doubling cache size yields diminishing returns after a certain threshold
Multi-Armed Bandit
A reinforcement learning approach for solving the exploration-exploitation dilemma in caching. The cache must balance exploiting known popular content against exploring new items that might become popular.
- Thompson Sampling: A Bayesian method that samples from posterior distributions to decide which content to cache
- Contextual Bandits: Incorporate features like time-of-day or user demographics into the caching decision
- Advantage over static policies: Bandit-based eviction adapts to concept drift where content popularity distributions shift over time, unlike fixed policies such as LRU
Coded Caching
An advanced technique that uses index coding to create coded multicast opportunities, significantly reducing peak traffic by serving multiple requests with a single transmission. This fundamentally changes the eviction calculus.
- Mechanism: During placement, the cache stores carefully designed coded fragments rather than complete files
- Delivery phase: A single multicast transmission satisfies multiple distinct requests simultaneously
- Eviction implication: Traditional eviction policies designed for uncoded content must be redesigned, as the value of a cached fragment depends on the global placement across all caches in the network

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us