dgraph-io / ristretto

A high performance memory-bound Go cache

Home Page:https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snapshot of current cache items

inge4pres opened this issue Β· comments

Hello there πŸ˜„ thanks for developing ristretto!
This is more of a general question rather than a issue: is there a way of creating a persistent snapshot for a running cache?
I've been trying with gob.NewEncoder(buffer).Encode(cache) but I have an error gob: type ristretto.Metrics has no exported fields which is (apparently) the intended behaviour of gob package (reference).
Any ideas if this is possible?
Thanks

Closing this since it's pretty much a duplicate of #105. If we decide to allow reading a snapshot for a warm startup, we should also enable writing a snapshot of the current items.

The issue with using gob is that accessing the unexported fields is not supported by golang. It's most likely using the reflect library which has this same limitation.