What would you cache?
Practice this questionDiscussion template: use your own project facts, ownership, and measured outcomes. Bracketed text is a placeholder.
Short explanation:
Caching reuses an earlier result to avoid repeated work. Good candidates are expensive repeated reads with an acceptable freshness window and a clear key. Caching is a poor shortcut when every answer must reflect the latest write or when users could share private results accidentally.
Key points:
-
Repeated expensive reads where a defined amount of stale data is acceptable.
-
Use expiry/invalidation and include user or tenant context in keys when needed.
-
Describe the key, expiry, invalidation trigger and behavior when the cache is unavailable.
Interview point:
- Name the correctness cost of stale data and why the business can accept it for the selected result.
Adapted from 10_RESUME_PROJECT_DEEP_DIVE.md · “What would you cache?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.