Data structures, caching patterns, persistence, pub/sub and cluster.
An online shop is adding Redis and the team lists candidates for caching: the category tree, product detail pages, each user's cart, the live stock count shown at checkout, and the order-payment status. Which would you cache, which not, and what rule of thumb are you using?
In a design review someone says "we'll use a read-through cache" and someone else says "we'll do cache-aside". In plain terms, what is the difference between the two, and which one is more common with Redis?
Customers in Germany report seeing prices in US dollars on a cached
product listing page, but only sometimes. The cache key is
listing:shoes:page:1. What is the bug, and how should the key be
built?
Bots are requesting /products/<random id> for ids that do not exist.
Every request misses the Redis cache and runs a database query that
finds nothing. How can the cache help here, and what should you be
careful about?
Your manager asks whether the new Redis cache is "working". Redis
reports keyspace_hits and keyspace_misses in INFO stats. What is a
cache hit ratio, how do you compute it from those numbers, and why is it
the first number people look at?
A travel site calls a slow third-party weather API (around two seconds per call) to show the forecast for each city. Describe how you would add Redis with the cache-aside pattern, step by step, including the key you would use.