Add DeleteFunc
This shares DeletePrefixs's implementation.
This commit is contained in:
@@ -154,6 +154,11 @@ func (c *LayeredCache) DeletePrefix(primary, prefix string) int {
|
||||
return c.bucket(primary).deletePrefix(primary, prefix, c.deletables)
|
||||
}
|
||||
|
||||
// Deletes all items that share the same primary key and where the matches func evaluates to true.
|
||||
func (c *LayeredCache) DeleteFunc(primary string, matches func(key string, item interface{}) bool) int {
|
||||
return c.bucket(primary).deleteFunc(primary, matches, c.deletables)
|
||||
}
|
||||
|
||||
//this isn't thread safe. It's meant to be called from non-concurrent tests
|
||||
func (c *LayeredCache) Clear() {
|
||||
for _, bucket := range c.buckets {
|
||||
|
Reference in New Issue
Block a user