steveyen / gkvlite

Simple, ordered, key-value persistence library for the Go Language
MIT License
263 stars 32 forks source link

manually evict items from memory #15

Open starius opened 7 years ago

starius commented 7 years ago

I would like to be able to evict an item (or at least its value) from memory. Reopening a database as advised in https://github.com/steveyen/gkvlite/issues/4#issuecomment-56056262 is suboptimal, as it introduces long pauses and memory usage is still rather high, because items are stored in memory all the time until I call Write, Flush and reopen the database.

Can you provide the following methods, please?

func (t *Collection) EvictValue(i *Item)
func (t *Collection) EvictItem(i *Item)

I would call one of them after I call Set or Get to reduce memory usage.