Redis cache vs in-memory local cache
When should you use Redis vs Caffeine/Guava local cache vs CDN edge cache?
Answers use simple, clear English.
Audio N/AQuick interview answer
Local cache: microsecond, per-instance, stale across pods — good for static config. Redis: shared across instances, TTL, eviction policies — session, rate limit, hot keys. CDN: static assets and cacheable HTTP responses at edge.
Detailed answer
Local cache: microsecond, per-instance, stale across pods — good for static config. Redis: shared across instances, TTL, eviction policies — session, rate limit, hot keys. CDN: static assets and cacheable HTTP responses at edge. Layer all three: CDN → local → Redis → DB.
Real example & use case
Product catalog: CDN for images, local Caffeine 30s for metadata, Redis 5min shared, Postgres source.
Pros & cons
Pros: latency pyramid. Cons: consistency windows at each tier.