HTTP caching browsers और CDNs को एक response को फिर से fetch करने के बजाय पुन: उपयोग करने देती है, जो Cache-Control header द्वारा नियंत्रित होती है। web apps के लिए विजयी pattern: अपने asset filenames को hash करें और उन्हें हमेशा के लिए cache करें; HTML को uncacheable रखें।
दो-स्तरीय रणनीति
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
