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.
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 asCacheTable.Value()
, but skips updating of keepAlive. In fact, I moved most of the code of theValue()
function to newvalueInternal()
function and both (Value()
andValueOnly()
) use it. It's likeaddInternal() 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