mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 07:41:02 +00:00
added purge for already saved keys
This commit is contained in:
parent
c4bda6c3ec
commit
da38f8f946
1 changed files with 8 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue