Closed JackPettinger closed 5 years ago
yes, can be done.
Redis can be used as out of process cache in scenarios similar to what you have to prevent loading stuff into cache multiple times. You don't have to though, but if you have Redis running anyways, why not give it a try ^^
I'm hoping somebody can help me, we're currently using LazyCache C# which uses Microsoft MemoryCache to cache the results of WebApi calls from an external system, I have to say it has worked well up until this point, however I failed to realize that it simply won't work with our server farm environment. We have two web servers behind a load balancer, which will each have it's own cache. We need something synchronized, hence why I've arrived here.
Currently with LazyCache we do something like this, which will cache the result of the WebApi request for the default 20 minutes, which is perfect.
_cache.GetOrAddAsync("key", () => await _requestService.GetWhatever(parameter));
I don't really want to store anything in Redis, unless anybody can give me a good argument to do so, maybe I just don't understand it properly... What I'd really like is to use Redis as a messenger, to simply tell the cache on server B that it's been changed (on server A)? Is this even possible?
We already have a Redis sever that we use for a signalR backplane with shared machine keys etc, and from reading the docs on this site, it seems that CacheManger will do something similar.
Can anybody confirm this?