TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Prevent CDN caching your updated JavaScript files

1 pointsby saikiabout 10 years ago

1 comment

_lce0about 10 years ago
TL;DR<p>extract some value from the file that changes with its content --like content&#x27;s md5, or modified timestamp-- and append it to the file name<p>for example, let&#x27;s say &quot;index.js&quot; and its md5 is &quot;30c2234&quot; (shortened for readability)<p><pre><code> &lt;script src=&quot;file-30c2234.js&quot;&gt; </code></pre> later when you modify the file, the hash change, and clients start to request the new one.<p>this allows to set cache&#x27;s evict time in doomsday