Skip to content

Commit

Permalink
fix reset not reset cache
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPlayer committed May 11, 2022
1 parent ac54a89 commit 7b6b026
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions timewatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func (w *TimeWatch) Reset(field string, d time.Duration) bool {
return false
}
c.TouchOffUnix = time.Now().Unix() + int64(d.Seconds())
bytes, _ := json.Marshal(c)
err = w.cache.HSet(w.key, c.Field, string(bytes))
if err != nil {
return false
}

if !timer.Stop() {
select {
Expand Down

0 comments on commit 7b6b026

Please sign in to comment.