实现新的CC

This commit is contained in:
刘祥超
2021-07-19 10:49:56 +08:00
parent d775dfeeaa
commit 7e37fc3b80
6 changed files with 71 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ func (this *Piece) Add(key uint64, item *Item) () {
func (this *Piece) IncreaseInt64(key uint64, delta int64, expiredAt int64) (result int64) {
this.locker.Lock()
item, ok := this.m[key]
if ok {
if ok && item.expiredAt > time.Now().Unix() {
result = types.Int64(item.Value) + delta
item.Value = result
item.expiredAt = expiredAt