Graph
Cache Eviction

🧠Cache Eviction

NEW

Also known as: Eviction Policy

The process and rules for removing cached entries to free space or maintain performance.

DESCRIPTION

Cache eviction defines how and when items are removed from a cache, typically due to capacity limits or freshness policies. Strategies include LRU, LFU, TTL-based and size-based eviction. Proper eviction improves hit ratios and latency while preventing memory exhaustion. Misconfigured policies cause thrashing, stale data, or uneven resource use. Effective designs consider workload patterns, object size distribution, and consistency requirements across distributed caches.

ALTERNATIVE DEFINITIONS

Redis Documentation

When Redis reaches the specified maxmemory limit it can begin to evict keys according to the selected eviction policy.

Describes memory-triggered eviction based on configured policies in Redis.

Source

Google Guava

Caches provide several mechanisms to evict entries: size-based eviction, time-based eviction, and reference-based eviction.

Enumerates common eviction mechanisms implemented in application caches.

Source

Cache Least Recently Used Least Frequently Used TTL Cache Hit Cache Miss Redis Memcached Guava Cache

COMPETING TERMS

Cache Invalidation

RELATIONS

KNOWLEDGE AREAS

Software Engineering Data Engineering Infrastructure Observability & Telemetry

TARGET AUDIENCE

Software Developer Data Engineer DevOps Engineer Solution Architect

EXTERNAL SOURCES

TOP QUESTIONS

What is cache eviction?

Cache eviction is the removal of entries from a cache based on policies such as capacity or freshness. It keeps memory usage under control and sustains performance.

Category: Definition

Which cache eviction policies are most common?

LRU, LFU, and TTL-based policies are common. Some systems use size-based or custom heuristics for workloads with large or skewed objects.

Category: Overview

How do I choose a cache eviction policy?

Analyze access patterns, object sizes, and consistency needs. LRU suits temporal locality; LFU fits repeated access; TTL works for predictable freshness.

Category: Requirements

What risks are associated with cache eviction?

Poorly chosen policies can cause thrashing, increased misses, and latency spikes. Evicting hot keys can degrade performance dramatically.

Category: Risks

How does cache eviction differ from cache invalidation?

Eviction removes entries due to resource policies; invalidation removes or marks entries stale due to data correctness or freshness requirements.

Category: Misunderstanding

What is a striking example of cache eviction?

Think of a bookshelf at capacity: removing least recently read books (LRU) makes space for new ones, preserving popular titles.

Category: Example

How is cache eviction monitored?

Track hit/miss ratios, eviction counts, latency, and memory usage. Observability tools and cache logs indicate load patterns and policy effectiveness.

Category: Management

What are common mistakes when configuring cache eviction?

Setting too small capacity, ignoring object size variability, and not tuning TTLs can cause frequent evictions and poor performance.

Category: Mistakes

How does cache eviction impact distributed caches?

Uneven eviction across nodes can cause hotspots. Coordinate policies and shard distribution to balance load and avoid skew.

Category: Opinion