mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 21:50:28 +08:00
缓存策略可以根据Key前缀进行批量删除
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/iwind/TeaGo/types"
|
"github.com/iwind/TeaGo/types"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
strings "strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PurgeAction struct {
|
type PurgeAction struct {
|
||||||
@@ -53,6 +53,7 @@ func (this *PurgeAction) RunGet(params struct {
|
|||||||
func (this *PurgeAction) RunPost(params struct {
|
func (this *PurgeAction) RunPost(params struct {
|
||||||
CachePolicyId int64
|
CachePolicyId int64
|
||||||
ClusterId int64
|
ClusterId int64
|
||||||
|
Type string
|
||||||
Keys string
|
Keys string
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
}) {
|
}) {
|
||||||
@@ -96,6 +97,11 @@ func (this *PurgeAction) RunPost(params struct {
|
|||||||
CachePolicyJSON: cachePolicyJSON,
|
CachePolicyJSON: cachePolicyJSON,
|
||||||
Keys: realKeys,
|
Keys: realKeys,
|
||||||
}
|
}
|
||||||
|
if params.Type == "prefix" {
|
||||||
|
msg.Type = messageconfigs.PurgeCacheMessageTypeDir
|
||||||
|
} else {
|
||||||
|
msg.Type = messageconfigs.PurgeCacheMessageTypeFile
|
||||||
|
}
|
||||||
results, err := nodeutils.SendMessageToCluster(this.AdminContext(), params.ClusterId, messageconfigs.MessageCodePurgeCache, msg, 10)
|
results, err := nodeutils.SendMessageToCluster(this.AdminContext(), params.ClusterId, messageconfigs.MessageCodePurgeCache, msg, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{$layout}
|
{$layout}
|
||||||
|
|
||||||
{$template "policy_menu"}
|
{$template "policy_menu"}
|
||||||
|
|
||||||
<h3>选择集群</h3>
|
<h3>选择集群</h3>
|
||||||
@@ -15,14 +14,25 @@
|
|||||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||||
<table class="ui table definition selectable">
|
<table class="ui table definition selectable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Key列表</td>
|
<td class="title">操作类型</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="keys" rows="10" ref="focus"></textarea>
|
<radio name="type" :v-value="'key'" v-model="type">根据Key</radio>
|
||||||
<p class="comment">每行一个Key。</p>
|
<radio name="type" :v-value="'prefix'" v-model="type">根据前缀</radio>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title">操作结果</td>
|
<td>
|
||||||
|
<span v-if="type == 'key'">Key列表</span>
|
||||||
|
<span v-if="type == 'prefix'">Key前缀列表</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea name="keys" rows="10" ref="focus"></textarea>
|
||||||
|
<p class="comment" v-if="type == 'key'">每行一个Key,比如是一个完整的URL<code-label>https://example.com/hello/world.html</code-label>。</p>
|
||||||
|
<p class="comment" v-if="type == 'prefix'">每行一个Key前缀,比如是一个URL前缀<code-label>https://example.com/hello/</code-label>。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>操作结果</td>
|
||||||
<td>
|
<td>
|
||||||
<div v-if="isRequesting">数据发送中...</div>
|
<div v-if="isRequesting">数据发送中...</div>
|
||||||
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
<span class="red" v-if="!isRequesting && !isOk && message.length > 0">失败:{{message}}</span>
|
||||||
|
|||||||
@@ -31,4 +31,9 @@ Tea.context(function () {
|
|||||||
this.done = function () {
|
this.done = function () {
|
||||||
this.isRequesting = false
|
this.isRequesting = false
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
this.type = "key" // key | prefix
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user