Caching
Understanding how Fresh caches documentation
Fresh caches fetched pages to improve performance and reduce server load.
How Caching Works
When you fetch a page, Fresh stores it in ~/.fresh/cache/. Subsequent requests check the cache first.
Cache Headers
Fresh respects HTTP caching headers:
Cache-ControlETagLast-Modified
If no headers are present, Fresh uses default TTL values.
Cache Management
View Cache Location
ls ~/.fresh/cache/Clear Cache
# Force refresh a specific URL
fresh get https://example.com/ --no-cache
# Clear all cache
rm -rf ~/.fresh/cache/Sync Force Refresh
fresh sync https://docs.python.org/3/ --forceCache Configuration
Environment Variables
| Variable | Description |
|---|---|
FRESH_CACHE_DIR | Override cache directory |
TTL Values
| Source Type | Default TTL |
|---|---|
| Documentation sites | 24 hours |
| API responses | 1 hour |
Performance Tips
- Use aliases - Cached for quick access
- Sync for offline - No network needed
- Limit sync scope - Only what you need
Troubleshooting
Stale Content
If content seems outdated:
fresh get <URL> --no-cacheCache Full
# Check cache size
du -sh ~/.fresh/cache/
# Clear old entries
fresh sync --force