问题描述
如何在不使用第三方插件的情况下在Play中指定用于资产指纹识别的ETag算法?
How to specify the ETag algorithm used for asset fingerprinting in Play without using third-party plugins?
例如,指定 ETag 为环境变量 BUILD_NUMBER
、文件的 GitHub 修订号及其时间/日期?知道如何做 GitHub 修订版真的很棒.:)
For example, specify that the ETag is to be the environment variable BUILD_NUMBER
, the GitHub revision number of the file, and its time/date? To know how to do the GitHub revision bit would be really great. :)
相关问题:在 URL 中嵌入 ETag &自动插入 ETag(资产指纹识别)为在资源顶部评论
Related questions: Embed ETag in URL & Automatically Insert ETag (asset fingerprinting) as comment at top of the resource
推荐答案
目前没有配置可能性来指定与 Play API 一起使用的 ETag 算法.
At present there is no configuration possibility to specify what ETag algorithm to use with the Play API.
Assets
类 可以扩展和覆盖,以保留 Play 在更改 ETag 算法时所做的积极缓存的所有好处.
The Assets
class can be extended and overridden to keep all the benefits of the aggressive caching that Play does when changing the ETag algorithm.
BUILD_NUMBER
可以传递给算法和 GitHub API 可用于获取任何文件的修订号.
The BUILD_NUMBER
can be passed in to the algorithm and the GitHub API can be used to obtain the revision number for any file.
这篇关于用于资产指纹识别的自定义 ETag 算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!