added purge for already saved keys

This commit is contained in:
Todd Gruben 2014-01-20 10:57:59 -06:00
parent c4bda6c3ec
commit da38f8f946

View file

@ -12,8 +12,9 @@ import (
)
type KVStorage struct {
db *gkvlite.Store
cc *gkvlite.Collection
db *gkvlite.Store
cc *gkvlite.Collection
evic_count int
}
func NewKVStorage(path string, slice int, db string) (Storage, error) {
@ -122,6 +123,10 @@ func (self *KVStorage) StoreBlock(bitmap_id int64, db string, slice int, chunk_k
value := Bytes(block)
self.cc.Set(key, value)
self.evic_count += 1
if self.evic_count > 10000 {
self.cc.EvictSomeItems()
self.evic_count = 0
}
return nil
}