How do I cache data on a Redis server which is used as SignalR backplane?

458 views Asked by At

I am using Redis Server as SignalR backplane in a Asp.net SignalR application. I also want to add some data in cache to the same Redis Server from the same application. The connection to the Redis server is maintained by the SignalR library and not exposed. Is it ok to create an additional connection to Redis server besides the one maintained by Signal library? The additional connection will allow me to store data in the Redis cache.

1

There are 1 answers

0
eglease On

Additional connections should be fine. SignalR uses Redis for messaging on the signalr channel. As long as you do not publish anything there yourself, it should work fine. We use the same Redis server as SignalR for different messages on different channels.

Just do redis = ConnectionMultiplexer.Connect("RedisHost:RedisPort"); where you want to make a new connection. RedisHost and RedisPort are the same as with SignalR.