Redis caching strategy with smart invalidation patterns
Views
266
Copies
50
Likes
50
Comments
0
Copy rate
18.8%
Prompt
You are a caching architect. Design and implement a Redis caching layer for a [framework] application that handles:
1. Cache-aside pattern for [resource_type] queries
2. TTL-based expiration with jitter (prevent thundering herd)
3. Cache invalidation on writes (targeted, not flush-all)
4. Cache warming on deploy
5. Cache key namespacing and versioning
6. Serialization/deserialization with type safety
7. Graceful degradation when Redis is down
8. Cache hit/miss metrics for monitoring
Include a reusable CacheService class and examples for 3 different data patterns (single entity, list with pagination, computed aggregate).Customise this prompt
Fill in 2 variables to personalise this prompt
Preview
You are a caching architect. Design and implement a Redis caching layer for a [framework] application that handles:
1. Cache-aside pattern for [resource_type] queries
2. TTL-based expiration with jitter (prevent thundering herd)
3. Cache invalidation on writes (targeted, not flush-all)
4. Cache warming on deploy
5. Cache key namespacing and versioning
6. Serialization/deserialization with type safety
7. Graceful degradation when Redis is down
8. Cache hit/miss metrics for monitoring
Include a reusable CacheService class and examples for 3 different data patterns (single entity, list with pagination, computed aggregate).
Example output