liveBook · Manning

LRU

Also called least recently used

LRU is a cache replacement policy that evicts the item whose most recent access occurred furthest in the past.

How 5 Manning books explain it

Fast by Default

An LRU cache stores reusable entries and evicts the entries that have gone unused for the longest time when capacity is exceeded.

How it is used
Bounds reusable application state to prevent unbounded memory growth in long-running desktop tools.
How deep it goes
Specifies entry-count bounds and last-access eviction, while deferring cache data-structure implementation details.
Examples
Uses document caches alongside size-limited undo stacks in desktop technical applications.
What you can do after
Operate/configure bounded caches and validate their memory behavior through extended-session performance testing.

Read how Fast by Default explains LRU →

Advanced Algorithms and Data Structures

An LRU cache is a cache that evicts the entry that has been unused for the longest time when it reaches capacity.

How it is used
Uses caching to avoid repeated computation while retaining fast lookup, insertion, retrieval, sizing, and eviction.
How deep it goes
Develops the hash-table and doubly-linked-list design through pseudocode, synchronized updates, and amortized constant-time analysis.
Examples
Uses company-name entries, an Acme cache miss, an EvilCorp update, and diagrams or pseudocode for insertion and eviction.
What you can do after
Build it from scratch with a capacity, hash table, doubly linked list, head, tail, insertion, lookup, update, and eviction operations.

Read how Advanced Algorithms and Data Structures explains LRU →

Acing the Frontend Interview

Least recently used eviction removes the cache item with the oldest recorded access when space is needed.

How it is used
Evaluates caching knowledge and efficient in-memory implementation in an interview-style system-design discussion.
How deep it goes
Explains eviction behavior, recency tracking, constant-time operations, and a complete TypeScript implementation.
Examples
Uses a TypeScript LRUCache, a React demo, and stale-entry eviction such as 1 → 1.
What you can do after
Build it from scratch with TypeScript Map operations that provide constant-time access, insertion, recency updates, and eviction.

Read how Acing the Frontend Interview explains LRU →

Designing Deep Learning Systems: A guide for software engineers

The least recently used algorithm evicts the item that has gone unused for the longest time when a cache reaches its capacity.

How it is used
Manages model swapping in multitenant prediction services when memory or GPU capacity cannot hold every required model.
How deep it goes
Defines the eviction role and pairs it with model partitioning, but defers detailed cache implementation to a prediction-service example.
Examples
Uses a multitenant prediction service and an intent-classification service to illustrate model caching and swapping.
What you can do after
Operate model caches that evict inactive models and free capacity for incoming prediction requests.

Read how Designing Deep Learning Systems: A guide for software engineers explains LRU →

Software Engineering for Data Scientists

An LRU cache is a cache that evicts the least recently used entries when its capacity is reached.

How it is used
Speeds repeated supervised machine-learning prediction calls in interactive applications.
How deep it goes
Defines recency-based eviction and demonstrates decorator-based caching, but stops short of implementing the mechanism internally.
Examples
Uses repeated random-forest predictions, runtime comparisons, a bounded cache, and an implementation exercise.
What you can do after
Apply it via Python’s functools.lru_cache to accelerate repeated model calls and limit cache growth.

Read how Software Engineering for Data Scientists explains LRU →

Also covered in

What to know first

Related concepts

Questions about LRU

What is LRU?

LRU is a cache replacement policy that evicts the item whose most recent access occurred furthest in the past.

Which Manning books explain LRU?

Fast by Default, Advanced Algorithms and Data Structures, Acing the Frontend Interview, Designing Deep Learning Systems: A guide for software engineers and Software Engineering for Data Scientists.

What should I know before learning LRU?

Manning books that teach LRU usually introduce caching, list and array first.

What is the difference between LRU and least frequently used?

LRU is a cache replacement policy that evicts the item whose most recent access occurred furthest in the past. Least frequently used is a cache-eviction policy that removes the entry with the lowest access frequency when capacity is exhausted.

What is LRU a kind of?

LRU is a kind of caching. Caching is the temporary storage of data or computed results for reuse, reducing the work or delay of retrieving or computing them again.

What is LRU also called?

LRU is also called least recently used.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.