优化计数器

This commit is contained in:
GoEdgeLab
2023-07-15 11:08:25 +08:00
parent f2cd4e2b02
commit 4f8d77d495
4 changed files with 38 additions and 14 deletions

View File

@@ -72,6 +72,6 @@ func (this *Item) Reset() {
}
}
func (this *Item) IsExpired() bool {
return this.lastUpdateTime < fasttime.Now().Unix()-this.lifeSeconds-this.spanSeconds
func (this *Item) IsExpired(currentTime int64) bool {
return this.lastUpdateTime < currentTime-this.lifeSeconds-this.spanSeconds
}