-
Notifications
You must be signed in to change notification settings - Fork 124
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
Export Touch function #40
Comments
Hi Derk, I understand this can be useful, but can you add your usecase? How would you use this functionality? I designed this expecting that you want the data with the key in order to do something useful. So if you explain how you would use it, it's probably an easy change. Greetings, Rene |
The idea is that when I want to add something to the cache, but the element with that key is already present, I instead just want to reset the TTL. I would say this is a valid use-case opposed to just using @ReneKroon if you have tips regarding my use-case I would love to hear them! This seemed like the most pragmatic approach for it, let me know if you agree. 😄 |
i added the code on master, can you verify that it works for you? |
By using
ttlcache.Cache#SkipTTLExtensionOnHit(bool)
you can disable touching the cache entry when usingGet
. This offers an additional level over control TTL behaviour.To offer even more control of this mechanism, I would like to propose to export a touch function as well:
Or something similar 😄
This is a lot more convenient that manually getting and setting the item with a new TTL.
The text was updated successfully, but these errors were encountered: