add Rename() support

This commit is contained in:
BugLesser 2022-12-29 05:35:39 +00:00
parent e521233701
commit c0459cf896
1 changed files with 2 additions and 0 deletions

View File

@ -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()