In a cache-aside (also known as lazy loading) approach, the cache doesn’t directly interact with the storage e.g., database. Instead, the application first queries the cache. If the cache results in a cache miss, then the query is made to the storage. After which, the entry is added to a cache. Lastly, the cached entry is returned to the user.
Disadvantages
- Each cache miss results in three trips (query cache, query storage, add entry to cache).
- If the data is updated in the database, the cache may still hold stale data.
- If a cache fails, it has to be repopulated.