The cache abstraction owns loading#
With read-through caching, the application asks a cache abstraction for a value. On a miss, that abstraction invokes a configured loader, stores the result, and returns it. Redis alone does not provide a generic database loader; a library or surrounding platform supplies this behavior.
| Concern | Cache-aside | Read-through |
|---|---|---|
| Miss fallback | Application code | Cache abstraction or loader |
| Read code | Explicit and flexible | Consistent and compact |
| Coupling | Application owns both dependencies | Cache layer understands retrieval |
| Operations | More repeated app logic | More involved cache platform |
It helps when a mature library or platform standardizes loaders across applications. It is less attractive when retrieval needs request-specific authorization or complex transactional context that should remain in application code.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Caching challenges and strategiesAmazon Builders' Library