提供服务器端方法,以确保客户端在更新资产时始终获取资产
cachebust的Python项目详细描述
cachebust提供了一种服务器端方法,以确保客户端在服务器上更新资产时始终获取资产。
许多浏览器有不同的缓存方式,有些会过度缓存,并且使用http缓存头,您可能总是需要在前一个脚本的生命周期内进行更新。
cachebust提供了一种方法来确保所有资产在更新时都由浏览器获取。它的工作方式是接受html(通过库或命令行工具)并修改资源hrefs,添加一个等于文件md5sum的参数“cachebust”。
当文件更改时,md5sum将更改,浏览器将其视为一个不同的文档,并且无论其缓存策略如何,都将获取更新。
用法
Usage: cacheBust (options) [input]
Options:
-r or –asset-root Specify the filesystem root which should be treated as “/” for links. Default is cwd
-e or –encoding Specify the encoding to use (default, utf-8)
-q or –quiet Do not print errors to stderr when cannot cachebust an element
–help Show this message
库文档
可在以下位置找到:http://htmlpreview.github.io/?https://github.com/kata198/cachebust/blob/master/doc/cachebust.html