thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Intermediate

Caching Strategy

Patterns for keeping a cache consistent with a database, such as cache-aside (lazy loading), write-through and write-behind.

Definition

Cache-aside loads data into the cache on a miss and is the most common pattern. Write-through updates cache and database together, keeping the cache fresh. Write-behind writes to the cache first and asynchronously to the database, which risks loss. TTLs bound staleness.

Exam tip

Lazy loading can serve stale data and pays a penalty on misses; write-through keeps data fresh but caches data that may never be read.

Related terms