bigcache icon indicating copy to clipboard operation
bigcache copied to clipboard

What is the recommended way to have cache never expire?

Open erickertz opened this issue 3 years ago • 2 comments

Sorry if this is addressed elsewhere, I couldn't seem to find a definite answer. LifeWindow 0 and CleanWindow 0 perhaps? Thanks!

erickertz avatar Oct 25 '21 17:10 erickertz

https://github.com/allegro/bigcache/blob/c2b72fe951a1ff765a0e58184738476f2fd71bb1/config.go#L11-L13 CleanWindow 0 should do the trick but if you run out of memory then entries will be deleted

janisz avatar Oct 25 '21 21:10 janisz

i also want to have cache never expire. in my case, i will refresh some keys regularly, but it would run out of memory, it due to the old value of these keys are not be deleted. i check the del/set func in BigCache, and it just remove the index. the old values only delete after expiration, does BigCache will support other delete strategy in the future?(like delete directly, no need to wait after expiration)

MCeDo avatar Nov 17 '21 17:11 MCeDo