Description
The application code effectively maintains the cache. It attempts to read from cache; if miss, it reads from DB and writes to cache.
Where to use
- General caching strategy. \n
- Read-heavy data.
Real World Example
App checks Redis for 'user:123'. If missing, fetches from MySQL, saves to Redis, and returns to user.
Code Example
class Cache-Aside:
def __init__(self):
pass
def execute(self):
print('Executing Cache-Aside')
