Make money doing the work you believe in

If I had to set up a cache,

I'd consider these 5 strategies:

1 Cache aside

→ Reads data from database on a cache miss and then populates it

→ Risk: inconsistency + extra latency

→ Best for: read-heavy workloads

===

2 Write through

→ App writes the data to the cache & then synchronously to database

→ Risk: high write latency, cache bloat

→ Best for: low-write, freshness-critical apps

===

3 Read through

→ Cache fetches data directly from DB on a miss—app never touches DB

→ Risk: inconsistency

→ Best for: read-heavy workloads

===

4 Write back

→ App writes the data to the cache & then asynchronously to the database

→ Risk: data loss if the cache crashes

→ Best for: high-throughput, write-heavy apps

===

5 Write around

→ Data is written to the database & cache gets populated on demand

→ Risk: cold reads = latency spike

→ Best for: large, rarely updated data

What else should make this list?

===

💾 Save & repost to help others understand cache strategies.

May 31
at
12:38 PM
Relevant people

Log in or sign up

Join the most interesting and insightful discussions.