add Rename() support
This commit is contained in:
parent
e521233701
commit
c0459cf896
2
cache.go
2
cache.go
|
@ -115,6 +115,8 @@ func (c *cache) Replace(k string, x interface{}, d time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename for the cache key only if it already exists, and the existing
|
||||||
|
// item hasn't expired. Returns an error otherwise.
|
||||||
func (c *cache) Rename(oldk, newk string) error {
|
func (c *cache) Rename(oldk, newk string) error {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue