You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I have to know (by key) which cache entry I want to remove. My use case is that at some event multiple keys should get invalidated (e.g. all keys with prefix xy). Currently I can maintain my own list of keys using SetNewItemCallback and SetExpirationReasonCallback but as I would have to deal with concurrency there as well I would love to see something similar in this library!
Untested draft:
func (cache *Cache) GetKeys() ([]string, error) {
cache.mutex.Lock()
if cache.isShutDown {
cache.mutex.Unlock()
return nil, ErrClosed
}
keys := make([]string, len(cache.items))
i := 0
for k := range cache.items {
keys[i] = k
i++
}
cache.mutex.Unlock()
return keys, nil
}
The text was updated successfully, but these errors were encountered:
The MR is good, it's failing coverage but that's because of another small thing i merged on master recently. You can use master if you like. I'll clean up the build and release a full version within roughly a week.
Currently I have to know (by key) which cache entry I want to remove. My use case is that at some event multiple keys should get invalidated (e.g. all keys with prefix xy). Currently I can maintain my own list of keys using
SetNewItemCallback
andSetExpirationReasonCallback
but as I would have to deal with concurrency there as well I would love to see something similar in this library!Untested draft:
The text was updated successfully, but these errors were encountered: