cache2go icon indicating copy to clipboard operation
cache2go copied to clipboard

PR to get cached value without updating it's keep alive

Open RatkoR opened this issue 3 years ago • 1 comments

Hi,

we have a use case where we need to get cached value without touching it's keepAlive value. We need our cached item to expire at whatever time it was about to expire even if we pulled it's value this one time.

So I added a ValueOnly() function that works the same as CacheTable.Value(), but skips updating of keepAlive. In fact, I moved most of the code of the Value() function to new valueInternal() function and both (Value() and ValueOnly()) use it. It's like addInternal() or deleteInternal() that you also use.

Test case TestCacheExpire has been extended to cover the new function and all tests pass.

Please tell what would need to be changed also, to maybe get this additional function merged.

PR is here: https://github.com/muesli/cache2go/pull/64

RatkoR avatar Nov 28 '22 09:11 RatkoR

Ahh, I see you already have a similar PR open: https://github.com/muesli/cache2go/pull/61/files. I'm fine if you merge #61 and close my PR.

RatkoR avatar Nov 28 '22 09:11 RatkoR