Caching Strategies: A Visual Guide

    How to Read This Post This post is a visual reference for caching strategies, organized by increasing complexity. Each section contains a Mermaid diagram followed by a brief explanation. No code — just patterns and pictures. Strategy Type Consistency Latency Complexity Best For Cache-Aside Read Eventual Low reads Low General purpose Read-Through Read Eventual Low reads Medium Read-heavy workloads Write-Through Write Strong High writes Medium Consistency-critical writes Write-Behind Write Eventual Low writes High Write-heavy workloads Write-Around Write Eventual Low writes Low Rarely-read written data LRU / LFU / TTL Eviction N/A N/A Low–Medium Memory management Consistent Hashing Distribution Varies Low High Horizontal scaling Multi-Layer Cache Read Eventual Very low High High-traffic systems Level 1 — Foundations 1. No Cache Baseline %%{init: {'theme':'dark', 'themeVariables': {'primaryTextColor':'#e5e7eb','secondaryTextColor':'#e5e7eb','tertiaryTextColor':'#e5e7eb','textColor':'#e5e7eb','nodeTextColor':'#e5e7eb','edgeLabelText':'#e5e7eb','clusterTextColor':'#e5e7eb','actorTextColor':'#e5e7eb'}}}%% flowchart LR subgraph Clients C1([Client 1]):::blue C2([Client 2]):::blue C3([Client 3]):::blue end subgraph Application A[App Server]:::purple end subgraph Storage DB[(Database)]:::red end C1 -->|Request| A C2 -->|Request| A C3 -->|Request| A A -->|"Query (50ms)"| DB DB -->|"Response (50ms)"| A A -->|"Total: ~100ms"| C1 A -->|"Total: ~100ms"| C2 A -->|"Total: ~100ms"| C3 classDef blue fill:#4a9eff,stroke:#4a9eff,color:#e5e7eb classDef red fill:#ff6b6b,stroke:#ff6b6b,color:#e5e7eb classDef purple fill:#a29bfe,stroke:#a29bfe,color:#e5e7eb No Cache Baseline — Every request hits the database directly. Under load, the database becomes the bottleneck: latency climbs, connections exhaust, and throughput collapses. This is the problem caching solves. ...

    March 15, 2026 · 11 min · Rafiul Alam

    Go Concurrency Pattern: The Collatz Explorer

    ← Mandelbrot Set | Series Overview The Problem: The Simplest Unsolved Math Problem The Collatz conjecture (3n+1 problem) is deceptively simple: Start with any positive integer n If n is even: divide by 2 If n is odd: multiply by 3 and add 1 Repeat until you reach 1 The conjecture: Every positive integer eventually reaches 1. Example (n=12): 12 → 6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1 The mystery: This has been verified for numbers up to 2^68, but never proven. It’s one of mathematics’ most famous unsolved problems. ...

    January 20, 2025 · 12 min · Rafiul Alam