Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RatkoR opened this issue Nov 28, 2022 · 1 comment
Open

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

RatkoR opened this issue Nov 28, 2022 · 1 comment

Comments

@RatkoR
Copy link

RatkoR commented Nov 28, 2022

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: #64

@RatkoR
Copy link
Author

RatkoR commented Nov 28, 2022

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 RatkoR changed the title PR to get cached value and not update it's keep alive PR to get cached value without updating it's keep alive Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant