实现缓存策略的部分功能

This commit is contained in:
GoEdgeLab
2020-10-05 16:54:21 +08:00
parent 1f11037d45
commit fcd9e4de06
5 changed files with 114 additions and 25 deletions

View File

@@ -17,7 +17,7 @@ func (this *HTTPRequestCondGroup) Init() error {
if len(this.Connector) == 0 {
this.Connector = "or"
}
if len(this.Conds) > 0 {
for _, cond := range this.Conds {
err := cond.Init()
@@ -43,6 +43,14 @@ func (this *HTTPRequestCondGroup) MatchResponse(formatter func(source string) st
return this.match(this.responseConds, formatter)
}
func (this *HTTPRequestCondGroup) HasRequestConds() bool {
return len(this.requestConds) > 0
}
func (this *HTTPRequestCondGroup) HasResponseConds() bool {
return len(this.responseConds) > 0
}
func (this *HTTPRequestCondGroup) match(conds []*HTTPRequestCond, formatter func(source string) string) bool {
if !this.IsOn || len(conds) == 0 {
return !this.IsReverse