Increment should return an error if the targeted item has expired
This commit is contained in:
@@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user