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
Custom Configuration
If presets don’t fit, you can write your own configuration.Global Handler
You can dynamically set Cache-Control for all requests.Practical Usage
Strategy by API
SSR Pages
Precautions
Next Steps
What is Cache-Control?
HTTP caching fundamentals
Using in APIs
Apply to @api decorators
Using in SSR
Apply to SSR pages