CachePresets Overview
Complete Preset List
noStore
No cache storage
noCache
Revalidate every time
shortLived
1 minute cache
ssr
SSR optimized (10 seconds + SWR)
mediumLived
5 minute cache
longLived
1 hour cache
immutable
Permanent cache (static files)
private
Personalized data
Preset Details
noStore
Completely prohibits cache storage.- Configuration
- When to Use
- Example
noCache
Stores cache but revalidates every time.- Configuration
- When to Use
- Example
shortLived
1 minute cache - Suitable for frequently changing data.- Configuration
- When to Use
- Example
ssr
SSR page optimization - 10 second cache + Stale-While-Revalidate 30 seconds- Configuration
- How It Works
- When to Use
- Example
mediumLived
5 minute cache - Suitable for rarely changing data.- Configuration
- When to Use
- Example
longLived
1 hour cache - Suitable for static content.- Configuration
- When to Use
- Example
immutable
Permanent cache - For static files with hash- Configuration
- When to Use
- Example
- Uses only cache without revalidation (fastest)
- When file changes → new hash → new filename → automatic cache update
private
Personalized data - Different response per user- Configuration
- When to Use
- Example
private: Cached only in browser (not on CDN)public: Cached everywhere (browser + CDN)
Preset Comparison Table
| Preset | Header | Use Case | TTL |
|---|---|---|---|
noStore | no-store | Sensitive data, Mutations | None |
noCache | no-cache | Requires revalidation | None (revalidate) |
shortLived | public, max-age=60 | Frequently changes | 1 minute |
ssr | public, max-age=10, stale-while-revalidate=30 | SSR pages | 10 seconds + SWR 30 seconds |
mediumLived | public, max-age=300 | Rarely changes | 5 minutes |
longLived | public, max-age=3600 | Static content | 1 hour |
immutable | public, max-age=31536000, immutable | Hashed files | 1 year (permanent) |
private | private, no-cache | Personalized data | None (private) |