Four Ways to Manage Your Cache

Explore the four main strategies for moving data between your cache and database

Read-Through Cache
When data isn't in the cache, it's automatically fetched from the database.
Read-Through Cache

Initial State

Step 1 of 6

The system starts with some data in the cache and all data in the database.

Current State

Application

Application ready to process read operations

Cache

key1: "value1"

Database

key1: "value1"
key2: "value2"
key3: "value3"

Implementation

Pros & Cons of Read-Through Cache

Pros

  • Automatic cache population
  • Simplified application logic
  • Cache always has requested data after first access

Cons

  • Initial read latency on cache miss
  • Potential for cache pollution
  • May fetch unnecessary data

Best For

Applications that need simple caching with minimal code complexity