mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
缓存策略里的默认缓存条件增加、修改或者删除后自动保存
This commit is contained in:
35
internal/web/actions/default/servers/components/cache/updateRefs.go
vendored
Normal file
35
internal/web/actions/default/servers/components/cache/updateRefs.go
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type UpdateRefsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *UpdateRefsAction) Init() {
|
||||
this.Nav("", "", "")
|
||||
}
|
||||
|
||||
func (this *UpdateRefsAction) RunPost(params struct {
|
||||
CachePolicyId int64
|
||||
RefsJSON []byte
|
||||
}) {
|
||||
// 修改缓存条件
|
||||
if params.CachePolicyId > 0 && len(params.RefsJSON) > 0 {
|
||||
_, err := this.RPC().HTTPCachePolicyRPC().UpdateHTTPCachePolicyRefs(this.AdminContext(), &pb.UpdateHTTPCachePolicyRefsRequest{
|
||||
HttpCachePolicyId: params.CachePolicyId,
|
||||
RefsJSON: params.RefsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
Reference in New Issue
Block a user