计算CC的时候不再跨时间范围累积

This commit is contained in:
GoEdgeLab
2022-05-12 21:48:33 +08:00
parent 04ae0d9994
commit 23192f6fec
7 changed files with 13 additions and 11 deletions

View File

@@ -114,7 +114,7 @@ func (this *CCCheckpoint) RequestValue(req requests.Request, param string, optio
if len(key) == 0 {
key = req.WAFRemoteIP()
}
value = this.cache.IncreaseInt64(key, int64(1), time.Now().Unix()+period)
value = this.cache.IncreaseInt64(key, int64(1), time.Now().Unix()+period, false)
}
return

View File

@@ -38,7 +38,7 @@ func (this *CC2Checkpoint) RequestValue(req requests.Request, param string, opti
threshold = 1000
}
value = ccCache.IncreaseInt64("WAF-CC-"+strings.Join(keyValues, "@"), 1, time.Now().Unix()+period)
value = ccCache.IncreaseInt64("WAF-CC-"+strings.Join(keyValues, "@"), 1, time.Now().Unix()+period, false)
return
}