System Design Patterns: From Fundamentals to Real Systems
Vote

0% completed

​

Cache-Aside

The store's catalog service answers every product page with this function:

def get_product(product_id): key = f"product:{product_id}" product = redis.get(key) # 1. check the cache if product is None: # a miss product = db.load_product(product_id) # 2. read the database redis.set(key, product, ex=3600) # 3. store a copy for 1 hour return product

The function asks Redis, an in-memory store, for a saved copy of the product

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content