From c0459cf8967306eb1e3f1b9b5249ccfc210fbef1 Mon Sep 17 00:00:00 2001 From: BugLesser <17674638850@163.com> Date: Thu, 29 Dec 2022 05:35:39 +0000 Subject: [PATCH] add Rename() support --- cache.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cache.go b/cache.go index 4f7630f..4c33353 100644 --- a/cache.go +++ b/cache.go @@ -115,6 +115,8 @@ func (c *cache) Replace(k string, x interface{}, d time.Duration) error { 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 { c.mu.Lock() defer c.mu.Unlock()