Caching 101: The Must-Know Caching Strategies
Fetching data is slow. Caching speeds things up by storing frequently accessed data for quick reads. But how do you populate and update the cache? That's where strategies come in.
🔍 Read Strategies:
Cache Aside (Lazy Loading)
- How it works: Tries cache first, then fetches from DB on cache miss
- Usage: When cache misses are rare or the latency of a cache miss + DB read is acceptable
Read Through
- How it works: Cache handles DB reads, transparently fetching missing data on cache miss
- Usage: Abstracts DB logic from app code. Keeps cache consistently populated by handling misses automatically
📝 Write Strategies:
Write Around
- How it works: Writes bypass the cache and go directly to the DB
- Usage: When written data won't immediately be read back from cache
Write Back (Delayed Write)
- How it works: Writes to cache first, async write to DB later
- Usage: In write-heavy environments where slight data loss is tolerable
Write Through
- How it works: Immediate write to both cache and DB
- Usage: When data consistency is critical
🚀 Real-Life Usage:
Cache Aside + Write Through
This ensures consistent cache/DB sync while allowing fine-grained cache population control during reads. Immediate database writes might strain the DB.
Read Through + Write Back
This abstracts the DB and handles bursting write traffic well by delaying sync. However, it risks larger data loss if the cache goes down before syncing the buffered writes to the database.
27 Followers 286 FollowingSystem Integration company with two main department first is the information technology solutions, second is business Applications especially ERPNext.
9K Followers 799 FollowingWorking 14h every day until I can retire my parents • Bootstrapping https://t.co/CGuuLPvYgB to $100k MRR • Build mobile apps in days: https://t.co/l7XMLyTLpi ($22k)
195K Followers 979 FollowingCreating software I love to use.
🌎 https://t.co/osszveVO4b NEW
🧠 https://t.co/p4T2vFZoJ1 $137K/m
🧰 https://t.co/y0Lq4RQRsu $5K/m
204K Followers 18K FollowingBuilding https://t.co/od97B0ItgS and https://t.co/6pSdm6nybd in Public. Raising all the boats with kindness.
🎙️ https://t.co/6w69DZmPYf · ✍️ https://t.co/lpnor5s0Ju
15K Followers 572 FollowingDesigner turned entrepreneur turned football club co-owner.
💸 3 successful exits →
📈 7-figure MRR →
⚽️ Co-owning a football club FK Žalgiris (est. 1947)
31K Followers 1K FollowingBuilding https://t.co/jL9cKJCP57, one of the best screenshot APIs for developers and agents, used by 1,000+ paying businesses from small to enterprises.
58K Followers 2K FollowingFounder @SiteGPT and @MCHQ_AI • Previously built and exited Feather for $250K • Tweeting about SiteGPT's journey from $10K MRR → $1M ARR.
2K Followers 734 Following23 y/o dev | i play with CARDS and AGENTS
🔸 https://t.co/oWN0acDd0f : Modern tooling for markdown based content sites
🔸DevSpace : Turn ChatGPT into Codex
20K Followers 253 FollowingCloud security historian
Developed https://t.co/ZXFwkuyseC, CloudMapper, and Parliament
Organizer for @fwdcloudsec
Researcher at @wiz_io
1K Followers 536 Followingwww = web web web · Staff Security Engineer @praetorianlabs · Previously 🌐 Security Researcher @starlabs_sg · Plays CTFs with HATS SG. Opinions are my own.
237K Followers 14K FollowingChief Evangelist @Amazon Web Services: follow me for AWS updates & chatter. Father of 5, grandfather of 7. Author, Maker, UW MCDM. @[email protected]
3K Followers 2K FollowingPowerShell MVP that is passionate about helping others succeed with Active Directory, Entra ID, Defender XDR, and Microsoft 365. Always learning! ✝️👨👩👧👦☕
46K Followers 2K FollowingSoftware Engineer. Prev, Riot. @MasterDotDev instructor. TanStack, React, C++ when I'm feeling nasty. Beer, whiskey, coffee snob. Book lover. Jr Dev for life.