The System Design Newsletter

The System Design Newsletter

Share this post

The System Design Newsletter
The System Design Newsletter
Everything You Need to Know About Cache Strategies ⭐

Everything You Need to Know About Cache Strategies ⭐

#74: A Simple Introduction to Cache Strategies (3 Minutes)

Neo Kim's avatar
Neo Kim
Jun 13, 2025
89

Share this post

The System Design Newsletter
The System Design Newsletter
Everything You Need to Know About Cache Strategies ⭐
9
8
Share

Get my system design playbook for FREE on newsletter signup:


This post outlines popular cache strategies. You will find references at the bottom of this page if you want to go deeper.

  • Share this post & I'll send you some rewards for the referrals.

Once upon a time, there lived a junior software engineer named Asahi.

He worked for a tech company named Hooli.

Although smart, he never received the opportunity to work on any interesting project.

So he was sad and frustrated.

cache strategies

Until one day, when he had the idea of applying for a new job.

And the interviewer asked him 1 simple question,

“Can you list 5 popular cache strategies?”.

Yet he failed to answer it, and the interview was over in 7 minutes.

So he studied it later to fill the knowledge gap.

Onward.


Shape the future of AI with Outlier—Sponsor

Outlier is hiring experienced developers to help train cutting-edge AI models with expert human feedback. Work flexibly from anywhere, get paid weekly (up to $50/hr), and apply your real-world dev skills to real AI challenges—no AI experience required.

Apply here


Cache Strategies

He failed the interview, so you don’t have to.

And here’s how you can answer it:

A cache is used to store frequently accessed data, thus serving future requests faster. Also it keeps data in memory for low latency. Yet the available memory is limited. So frequent updates to the cache are necessary.

The technique of storing, retrieving, and managing data in a cache for performance and optimal memory usage is called a cache strategy.

1. Cache Aside Strategy

Cache Aside Strategy

The cache aside is one of the most popular cache strategies.

It’s also called lazy loading because data gets cached only when it’s queried.

Here’s how it works:

  1. The app tries to read data from the cache

  2. It then reads data from the database on a cache miss

  3. The data gets written to the cache

A cache miss means the queried data is unavailable in the cache.

Besides the cache doesn't interact with the database directly; instead, the app does.

This strategy is easy to implement. But there’s a risk of data inconsistency and extra latency because of network round trips.

It’s used in read-heavy workloads, such as configuration data or user profiles.

Ready for the next technique?

2. Write Through Strategy

Write Through Cache Strategy

The write-through cache strategy ensures strong consistency between the cache and the database.

Here’s how it works:

  1. The app writes to the cache

  2. The cache then writes to the database synchronously.

The app doesn't interact with the database directly; instead, the cache does.

Although this strategy offers data consistency, the latency on writes is higher. Also the cache space might get wasted with infrequently accessed data.

It’s used where write rate is low, and when data freshness is critical.

3. Read Through Strategy

Read Through Cache Strategy

The read-through cache strategy installs the cache between the app and the database. This means all reads go through the cache.

Here’s how it works:

  1. The app reads data from the cache

  2. Then it reads data from the database on a cache miss

  3. The data gets written to the cache and then returned to the app

The app doesn't interact with the database directly; instead, the cache does.

Although this strategy offers low latency, there’s a risk of data inconsistency.

It’s used in read-heavy workloads, such as a newsfeed or a product catalog.

Let’s keep going!

4. Write Back Strategy

Write Back Cache Strategy

The write-back strategy writes data to the cache for batching and performance. This means write latency is low.

Here’s how it works:

  1. The app writes to the cache directly

  2. The cache then writes data to the database asynchronously

This strategy offers better write performance through batching. Yet there’s a risk of data loss if the cache fails before writing to the database.

It’s used in write-heavy workloads where throughput is more important than durability.

5. Write Around Strategy

Write Around Cache Strategy

Here’s how the write-around cache strategy works:

  1. The app writes to the database

  2. It tries to read data from the cache later

  3. The app reads from the database on a cache miss

  4. It then updates the cache

Although this strategy optimizes cache storage for frequently accessed data, there is a risk of increased latency because of cache misses.

It’s used for large data objects where updates happen rarely.


TL;DR:

The 2 popular cache implementations are Redis and Memcached.

  • Read heavy workload: use cache aside or read through strategies

  • Consistency vs throughput: use write-through or write-back strategies

  • Avoid caching one-off writes: use write-around strategy

It’s important to pick the right cache strategy based on your needs and tradeoffs.


Subscribe to get simplified case studies delivered straight to your inbox:


Author Neo Kim; System design case studies
👋 Find me on LinkedIn | Twitter | Threads | Instagram

Want to advertise in this newsletter? 📰

If your company wants to reach a 150K+ tech audience, advertise with me.


Thank you for supporting this newsletter. Consider sharing this post with your friends and get rewards. Y’all are the best.

system design newsletter

Share


TL;DR 🕰️

You can find a summary of this article here. Consider a repost if you find it helpful.


How API Gateway Actually Work ⭐

How API Gateway Actually Work ⭐

Neo Kim
·
May 29
Read full story
How Load Balancing Algorithms Really Work ⭐

How Load Balancing Algorithms Really Work ⭐

Neo Kim
·
May 19
Read full story

References

  • Introduction to database caching

  • From cache to in-memory data grid. Introduction to Hazelcast

  • Using Read-through Cache & Write-through Cache

  • Redis official site

  • Memcached official site

Asia's avatar
DiegoAGtz's avatar
Prerit Sarvaiya's avatar
Ishan Gupta's avatar
Rafa Páez's avatar
89 Likes∙
8 Restacks
89

Share this post

The System Design Newsletter
The System Design Newsletter
Everything You Need to Know About Cache Strategies ⭐
9
8
Share

Discussion about this post

User's avatar
Kevin Naughton Jr.'s avatar
Kevin Naughton Jr.
Jun 13

congrats on 150k Neo! :)

Expand full comment
Like (2)
Reply
Share
1 reply by Neo Kim
Raul Junco's avatar
Raul Junco
Jun 13

Cache is probably the closest thing we have to a silver bullet.

But only if you're willing to aim it carefully, invalidation is still hard.

Good breakdown, Neo.

Expand full comment
Like (1)
Reply
Share
1 reply by Neo Kim
7 more comments...
8 Reasons Why WhatsApp Was Able to Support 50 Billion Messages a Day With Only 32 Engineers
#1: Learn More - Awesome WhatsApp Engineering (6 minutes)
Aug 27, 2023 • 
Neo Kim
749

Share this post

The System Design Newsletter
The System Design Newsletter
8 Reasons Why WhatsApp Was Able to Support 50 Billion Messages a Day With Only 32 Engineers
25
How PayPal Was Able to Support a Billion Transactions per Day With Only 8 Virtual Machines
#30: Learn More - Awesome PayPal Engineering (4 minutes)
Dec 26, 2023 • 
Neo Kim
267

Share this post

The System Design Newsletter
The System Design Newsletter
How PayPal Was Able to Support a Billion Transactions per Day With Only 8 Virtual Machines
14
How Stripe Prevents Double Payment Using Idempotent API
#45: A Simple Introduction to Idempotent API (4 minutes)
May 9, 2024 • 
Neo Kim
405

Share this post

The System Design Newsletter
The System Design Newsletter
How Stripe Prevents Double Payment Using Idempotent API
30

Ready for more?

© 2025 Neo Kim
Publisher Privacy
Substack
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Create your profile

User's avatar

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.

User's avatar

Yura Rochniak, a subscriber of The System Design Newsletter, shared this with you.