实现缓存策略部分管理功能

This commit is contained in:
刘祥超
2020-10-02 17:22:32 +08:00
parent c76f941064
commit 9c6efad81f
14 changed files with 595 additions and 56 deletions

View File

@@ -663,7 +663,7 @@ func (this *ServerDAO) FindServerWebId(serverId int64) (int64, error) {
}
// 计算使用SSL策略的所有服务数量
func (this *ServerDAO) CountServersWithSSLPolicyIds(sslPolicyIds []int64) (count int64, err error) {
func (this *ServerDAO) CountAllEnabledServersWithSSLPolicyIds(sslPolicyIds []int64) (count int64, err error) {
if len(sslPolicyIds) == 0 {
return
}
@@ -678,8 +678,8 @@ func (this *ServerDAO) CountServersWithSSLPolicyIds(sslPolicyIds []int64) (count
Count()
}
// 查找使用SSL策略的所有服务
func (this *ServerDAO) FindAllServersWithSSLPolicyIds(sslPolicyIds []int64) (result []*Server, err error) {
// 查找使用某个SSL策略的所有服务
func (this *ServerDAO) FindAllEnabledServersWithSSLPolicyIds(sslPolicyIds []int64) (result []*Server, err error) {
if len(sslPolicyIds) == 0 {
return
}
@@ -698,6 +698,31 @@ func (this *ServerDAO) FindAllServersWithSSLPolicyIds(sslPolicyIds []int64) (res
return
}
// 计算使用某个缓存策略的所有服务数量
func (this *ServerDAO) CountEnabledServersWithWebIds(webIds []int64) (count int64, err error) {
if len(webIds) == 0 {
return
}
return this.Query().
State(ServerStateEnabled).
Attr("webId", webIds).
Count()
}
// 查找使用某个缓存策略的所有服务
func (this *ServerDAO) FindAllEnabledServersWithWebIds(webIds []int64) (result []*Server, err error) {
if len(webIds) == 0 {
return
}
_, err = this.Query().
State(ServerStateEnabled).
Attr("webId", webIds).
AscPk().
Slice(&result).
FindAll()
return
}
// 创建事件
func (this *ServerDAO) createEvent() error {
return SharedSysEventDAO.CreateEvent(NewServerChangeEvent())