replace on layeredcache

This commit is contained in:
Karl Seguin
2014-11-13 22:23:52 +07:00
parent 65573a0cb6
commit 7316f99bd9
3 changed files with 26 additions and 4 deletions

View File

@@ -35,6 +35,16 @@ func (b *LayeredBucket) set(primary, secondary string, value interface{}, durati
return item, new
}
func (b *LayeredBucket) replace(primary, secondary string, value interface{}) bool {
b.Lock()
bucket, exists := b.buckets[primary]
b.Unlock()
if exists == false {
return false
}
return bucket.replace(secondary, value)
}
func (b *LayeredBucket) delete(primary, secondary string) *Item {
b.RLock()
bucket, exists := b.buckets[primary]