Add Reset func to memo
Add a new function Reset to memo to forcibly reset the cache
This commit is contained in:
@@ -67,3 +67,12 @@ func (memo *Memo) Get() (value interface{}, err error) {
|
|||||||
}
|
}
|
||||||
return memo.cache.res.value, memo.cache.res.err
|
return memo.cache.res.value, memo.cache.res.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset forcibly resets the cache to nil.
|
||||||
|
func (memo *Memo) Reset() {
|
||||||
|
defer memo.mu.Unlock()
|
||||||
|
memo.mu.Lock()
|
||||||
|
|
||||||
|
memo.cache = nil
|
||||||
|
memo.lastCache = time.Now()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user