Replies: 1 comment 1 reply
-
Wouldn't this solve the issue? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really love ttlcache and use it in every my project.
Recently I implemented a basic controller logic and fount it convenient to use ttlacache again yet I found one feature which would bring atomic operations to the cache only in case the cache item exists.
I will elaborate. The Get() method allows to fetch the cache item, yet, it also runs the loader if it is used in the cache. But what I need is to distinguish the case when I want to get the item when it exists already and when I want to get it and create if it does not exist yet. A good option for me is to use a callback which would be executed for the cache item only in case it exists already.
Now I have to use the Has() method and then Get() method. But between them item can be deleted and Get() method will create the item again what I do not need.
Beta Was this translation helpful? Give feedback.
All reactions