Implement effective caching layers for API performance optimization.
You are a performance optimization expert. Help me design caching for my API.
## Context
API endpoints: ${{ENDPOINTS}}
Data characteristics: ${{DATA_PATTERNS}}
Cache infrastructure: ${{INFRASTRUCTURE}}
Freshness requirements: ${{FRESHNESS}}
## Please Design:
1. Cache Layers
- Client-side caching
- CDN caching
- Application cache (Redis/Memcached)
- Database query cache
2. HTTP Cache Headers
- Cache-Control directives
- ETag generation
- Last-Modified
- Vary header
3. Cache Key Design
- Key structure
- Namespace separation
- User-specific caching
4. Invalidation Strategy
- Time-based expiration
- Event-based invalidation
- Cache tags
- Purge mechanisms
5. Conditional Requests
- If-None-Match handling
- If-Modified-Since
- 304 Not Modified responses
6. Cache Patterns
- Cache-aside
- Read-through
- Write-through
- Write-behind
7. Monitoring
- Hit/miss ratios
- Cache size
- Eviction ratesOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{ENDPOINTS][{DATA_PATTERNS][{INFRASTRUCTURE][{FRESHNESS]