muesli / cache2go

Concurrency-safe Go caching library with expiration capabilities and access counters
Other
2.11k stars 518 forks source link

[Feature Request] Persisting cache data to disk #32

Open vzool opened 5 years ago

vzool commented 5 years ago

Hi, I like this library because it is simple to use. But, I couldn't find a way to persisting cache to disk in order to retrieve cache after accidental application shutdown. Do you like to add this feature in the future?

Thanks

chengyayu commented 5 years ago

Hi, I like this library because it is simple to use. But, I couldn't find a way to persisting cache to disk in order to retrieve cache after accidental application shutdown. Do you like to add this feature in the future?

Thanks

why don't you use Redis? I think this package is best used in the business layer cache.

vzool commented 5 years ago

Yes, I think so. But, I prefer a simple solution and I just did it by swap this library with LevelDB as a cache. Thanks for your response ^_^

muesli commented 5 years ago

I tend to agree: I think this is out of cache2go's scope. That said it would probably be fairly simple to (un)marshall the data, and I'm not opposed to a patch - should someone fancy tackling it.