feat(fs): Support customizing the cache time for a specific path #1533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description / 描述
支持自定义文件路径的缓存时间,
*匹配单层目录,**匹配多层目录。配置方式如下:按照以上规则,缓存方式如下:
/文件/历史存档目录及其子目录下所有文件将被缓存300分钟/文件/本月新增目录及其子目录下所有文件将被缓存30分钟历史存档和本月新增这两个目录外,/文件目录及其子目录将应用驱动的默认缓存时间/音乐目录下的所有文件将被缓存30分钟,不包括子目录。例如/音乐/A/B将不会命中规则/游戏目录下的子目录将会命中规则,例如/游戏/A目录下的文件将会被缓存60分钟,但直属于 '/游戏' 目录下的文件将应用驱动的默认缓存时间规则遵循优先匹配的原则,上面的规则越先命中。
Motivation and Context / 背景
当前目录的缓存时间统一由
cache_expiration控制,实际使用中不同目录下的资源更新频率不同,基于此功能可以单独给这些目录设置更长/更短的缓存时间。How Has This Been Tested? / 测试
通过指定不同路径的缓存时间测试每个路径的缓存规则。
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。