Increment should return an error if the targeted item has expired
This commit is contained in:
parent
e5b84e20fc
commit
ac1a1aeef9
2
cache.go
2
cache.go
|
@ -191,7 +191,7 @@ func (c *cache) IncrementFloat(k string, n float64) error {
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
||||||
v, found := c.Items[k]
|
v, found := c.Items[k]
|
||||||
if !found {
|
if !found || v.Expired() {
|
||||||
return fmt.Errorf("Item not found")
|
return fmt.Errorf("Item not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue