diff --git a/memo/memo.go b/memo/memo.go index a31c8be..8a88ccd 100644 --- a/memo/memo.go +++ b/memo/memo.go @@ -67,3 +67,13 @@ func (memo *Memo) Get() (value interface{}, err error) { } return memo.cache.res.value, memo.cache.res.err } + +// Reset forcibly resets the cache to nil without checking if the cache +// duration has elapsed. +func (memo *Memo) Reset() { + defer memo.mu.Unlock() + memo.mu.Lock() + + memo.cache = nil + memo.lastCache = time.Now() +}