diff --git a/web/public/js/components/server/http-cache-config-box.js b/web/public/js/components/server/http-cache-config-box.js index b5e2d3ff..88117d34 100644 --- a/web/public/js/components/server/http-cache-config-box.js +++ b/web/public/js/components/server/http-cache-config-box.js @@ -26,6 +26,9 @@ Vue.component("http-cache-config-box", { isOn: function () { return ((!this.vIsLocation && !this.vIsGroup) || this.cacheConfig.isPrior) && this.cacheConfig.isOn }, + isPlus: function () { + return Tea.Vue.teaIsPlus + }, generatePurgeKey: function () { let r = Math.random().toString() + Math.random().toString() let s = r.replace(/0\./g, "") @@ -38,6 +41,9 @@ Vue.component("http-cache-config-box", { }, showMoreOptions: function () { this.moreOptionsVisible = !this.moreOptionsVisible + }, + changeStale: function (stale) { + this.cacheConfig.stale = stale } }, template: `
@@ -94,14 +100,14 @@ Vue.component("http-cache-config-box", { - 允许PURGE + 允许PURGE

允许使用PURGE方法清除某个URL缓存。

- PURGE Key * + PURGE Key *

[随机生成]。需要在PURGE方法调用时加入Edge-Purge-Key: {{cacheConfig.purgeKey}} Header。只能包含字符、数字、下划线。

@@ -110,7 +116,12 @@ Vue.component("http-cache-config-box", { -
+
+

陈旧缓存策略

+ +
+ +

缓存条件

diff --git a/web/public/js/components/server/http-cache-stale-config.js b/web/public/js/components/server/http-cache-stale-config.js new file mode 100644 index 00000000..4a5abdaf --- /dev/null +++ b/web/public/js/components/server/http-cache-stale-config.js @@ -0,0 +1,61 @@ +Vue.component("http-cache-stale-config", { + props: ["v-cache-stale-config"], + data: function () { + let config = this.vCacheStaleConfig + if (config == null) { + config = { + isPrior: false, + isOn: false, + status: [], + supportStaleIfErrorHeader: true, + life: { + count: 1, + unit: "day" + } + } + } + return { + config: config + } + }, + watch: { + config: { + deep: true, + handler: function () { + this.$emit("change", this.config) + } + } + }, + methods: {}, + template: ` + + + + + + + + + + + + + + + + + + +
启用陈旧缓存 + +

选中后,在更新缓存失败后会尝试读取陈旧的缓存。

+
有效期 + +

缓存在过期之后,仍然保留的时间。

+
状态码 +

在这些状态码出现时使用陈旧缓存,默认支持50x状态码。

+
支持stale-if-error + +

选中后,支持在Cache-Control中通过stale-if-error指定陈旧缓存有效期。

+
` +}) \ No newline at end of file