You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are instances, such as session validation, where a consumer only wants to confirm that an item exists in the cache and not create it. This is not currently (directly) possible with the HybridCache implementation.
I have another type of issue with not having a simple Get method. I would like to cache the access token so I don't need to obtain it every time I call some API. The problem is that I want to configure the absolute expiration of the cache entry based on the expiration of the token provided by the factory method.
The solution to my problem would be either
having Get method, or
having an overload of the GetOrCreate method accepting the delegate to create HybridCacheEntryOptions, something like this Func<CancellationToken, T, HybridCacheEntryOptions>
I can make this work using the existing API but I'm not a fan of my solution so if anyone has a better workaround let me know.
I don't know if this is better for you but it probably is a bit less expensive as it does not use exceptions. And it could cache null and still would tell you if not found or null was cached
I don't know if this is better for you but it probably is a bit less expensive as it does not use exceptions. And it could cache null and still would tell you if not found or null was cached
Background and motivation
There are instances, such as session validation, where a consumer only wants to confirm that an item exists in the cache and not create it. This is not currently (directly) possible with the
HybridCache
implementation.API Proposal
API Usage
Alternative Designs
I can make this work using the existing API but I'm not a fan of my solution so if anyone has a better workaround let me know.
More efficient option suggested by @nibdev
Risks
No response
The text was updated successfully, but these errors were encountered: