Add DeletePrefix to LayeredCache

This commit is contained in:
Bjørn Erik Pedersen
2020-08-11 18:53:40 +02:00
parent 3b58df727e
commit a24d7f8c53
3 changed files with 39 additions and 0 deletions

View File

@@ -61,6 +61,16 @@ func (b *layeredBucket) delete(primary, secondary string) *Item {
return bucket.delete(secondary)
}
func (b *layeredBucket) deletePrefix(primary, prefix string, deletables chan *Item) int {
b.RLock()
bucket, exists := b.buckets[primary]
b.RUnlock()
if exists == false {
return 0
}
return bucket.deletePrefix(prefix, deletables)
}
func (b *layeredBucket) deleteAll(primary string, deletables chan *Item) bool {
b.RLock()
bucket, exists := b.buckets[primary]