// 单个缓存条件设置 Vue.component("http-cache-ref-box", { props: ["v-cache-ref", "v-is-reverse"], mounted: function () { this.$refs.variablesDescriber.update(this.ref.key) }, data: function () { let ref = this.vCacheRef if (ref == null) { ref = { isOn: true, cachePolicyId: 0, key: "${scheme}://${host}${requestPath}${isArgs}${args}", life: {count: 2, unit: "hour"}, status: [200], maxSize: {count: 32, unit: "mb"}, minSize: {count: 0, unit: "kb"}, skipCacheControlValues: ["private", "no-cache", "no-store"], skipSetCookie: true, enableRequestCachePragma: false, conds: null, allowChunkedEncoding: true, isReverse: this.vIsReverse } } if (ref.key == null) { ref.key = "" } if (ref.life == null) { ref.life = {count: 2, unit: "hour"} } if (ref.maxSize == null) { ref.maxSize = {count: 32, unit: "mb"} } if (ref.minSize == null) { ref.minSize = {count: 0, unit: "kb"} } return { ref: ref, moreOptionsVisible: false } }, methods: { changeOptionsVisible: function (v) { this.moreOptionsVisible = v }, changeLife: function (v) { this.ref.life = v }, changeMaxSize: function (v) { this.ref.maxSize = v }, changeMinSize: function (v) { this.ref.minSize = v }, changeConds: function (v) { this.ref.conds = v }, changeStatusList: function (list) { let result = [] list.forEach(function (status) { let statusNumber = parseInt(status) if (isNaN(statusNumber) || statusNumber < 100 || statusNumber > 999) { return } result.push(statusNumber) }) this.ref.status = result }, changeKey: function (key) { this.$refs.variablesDescriber.update(key) } }, template: `
用来区分不同缓存内容的唯一Key。
内容尺寸如果高于此值则不缓存。
内容尺寸如果低于此值则不缓存。
选中后,Gzip和Chunked内容可以直接缓存,无需检查内容长度。
允许缓存的HTTP状态码列表。
当响应的Cache-Control为这些值时不缓存响应内容,而且不区分大小写。
选中后,当响应的Header中有Set-Cookie时不缓存响应内容。
选中后,当请求的Header中含有Pragma: no-cache或Cache-Control: no-cache时,会跳过缓存直接读取源内容。