Created
August 7, 2020 22:10
-
-
Save luislobo14rap/cae476de147d035da8ea794e74b3cd5b to your computer and use it in GitHub Desktop.
cache-expires-after.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cache-expires-after.js v1 | |
function cacheExpiresAfter(delay = 1, prefix = '', suffix = '') { // seconds | |
let now = new Date().getTime().toString(); | |
now = now.substring(now.length - 11, 10); // remove decades and milliseconds | |
now = parseInt(now / delay).toString(); | |
return prefix + now + suffix; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files/63309105#63309105