HTTP caching browser లు మరియు CDN లను ఒక response ను తిరిగి fetch చేయడానికి బదులుగా తిరిగి వాడనిస్తుంది, ఇది Cache-Control header ద్వారా నియంత్రించబడుతుంది. Web app ల కోసం విజయవంతమైన pattern: మీ asset filename లను hash చేసి వాటిని శాశ్వతంగా cache చేయండి; HTML ను uncacheable గా ఉంచండి.
రెండు-tier strategy
http
# Hashed, versioned assets — content never changes for a given URL
Cache-Control: public, max-age=31536000, immutable
# e.g. /static/app.9f2c1a.js (the hash changes when content changes)
# HTML — must always be fresh so it can point at new asset hashes
Cache-Control: no-cache
