IdentityServer's ICache<T> interface has superfluous functionality, which makes it hard to implement.
#251
eugene-rebedailo
started this conversation in
Feature requests
Replies: 2 comments 1 reply
|
Removing You can implement public async Task<T?> GetAsync(string key)
{
return await cache.GetOrCreateAsync(key, _ => ValueTask.FromResult(default(T?)),
new HybridCacheEntryOptions
{
Flags = HybridCacheEntryFlags.DisableLocalCacheWrite |
HybridCacheEntryFlags.DisableDistributedCacheWrite
});
} |
1 reply
|
We've moved to |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I was trying to implement MS's hybrid cache for identity server, because I have an API attached to it that manages server's configuration in an environment with a lot of distributed services. I am trying to implement resource cache invalidation upon updates to said resources, so way to do this this would be to replace IdentityServer's stock implementation of
ICache<T>for certain resources.The best fit for this in my scenario would be to use Microsoft's Hybrid Cache because it supports cache invalidation by tags (which is desirable in my case), but the issue is that it doesn't expose
Getby itself, onlyGetOrCreate, which is arguably a more semantically correct way to use the cache. Looking at the sources, it doesn't seem too daunting to remove this method in favour ofGetOrCreate.Is the
Getmethod really necessary in this interface?All reactions