Learn Everything

Paths/Backend Engineer/Caching & Performance / Cache Strategies

Guided Taskbeginnerubuntu:24.04Ask AI

Choose a Read-Through Policy

A read-through cache keeps the calling code simple - it asks the cache and the cache knows how to load. Write the policy.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • Directory ~/backend/cache exists○
  • File ~/backend/cache/policy.yaml exists○
  • The config names the strategy and the TTL○
  • The config names the key namespace and the serialisation format○

02Walkthrough

3 steps
  1. 01

    Write the cache policy

    read-through means the cache calls the loader on a miss. The calling code never knows the difference.

    echo 'cache:\n strategy: read-through\n namespace: orders:v2\n ttl_seconds: 300\n serialisation: json\n loader: db.orders.fetch' > ~/backend/cache/policy.yaml
  2. 02

    Verify the policy

    cat prints the policy. Ask what happens when the loader is slow.

    cat ~/backend/cache/policy.yaml
  3. 03

    Submit for validation

    The validator checks the strategy, the TTL and the namespace.

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list