缓存策略可以根据Key前缀进行批量删除

This commit is contained in:
GoEdgeLab
2021-05-23 22:49:53 +08:00
parent b11c7f4ffb
commit e8ef4b45aa
3 changed files with 57 additions and 36 deletions

View File

@@ -12,7 +12,7 @@ import (
"github.com/iwind/TeaGo/types"
"net/http"
"strconv"
strings "strings"
"strings"
)
type PurgeAction struct {
@@ -53,6 +53,7 @@ func (this *PurgeAction) RunGet(params struct {
func (this *PurgeAction) RunPost(params struct {
CachePolicyId int64
ClusterId int64
Type string
Keys string
Must *actions.Must
}) {
@@ -96,6 +97,11 @@ func (this *PurgeAction) RunPost(params struct {
CachePolicyJSON: cachePolicyJSON,
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)
if err != nil {
this.ErrorPage(err)