The app for independent voices

If I wanted to set up a cache,

I'd consider these 5 strategies:

1 Cache aside

↳ Reads data from the 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 and then synchronously to the database

↳ Risk: high write latency, cache bloat

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

——

3 Read through

↳ Cache fetches data directly from the DB on a miss--the app never touches the DB

↳ Risk: inconsistency

↳ Best for: read-heavy workloads

——

4 Write back

↳ App writes the data to the cache and 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, and the cache gets populated on demand

↳ Risk: cold reads = latency spike

↳ Best for: large, rarely updated data

What else should make this list?

Feb 24
at
1:43 PM
Relevant people

Log in or sign up

Join the most interesting and insightful discussions.