实现新的CC

This commit is contained in:
GoEdgeLab
2021-07-19 10:49:56 +08:00
parent 13f619e142
commit 3e98f32e26
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