Using two PooledRedisClientManagers in same app

Is it possible to use more than one PooledRedisClientManagers in the same app?

My use case is to use one pool to talk to a redis instance/cluster and the other to talk to the Tile38 geolocation server, which uses the redis RESP protocol.

Are there any problems with doing this? If so, do you have any suggestions of how to proceed?

Thanks

PooledRedisClientManager uses own pool for each instance so you can create two PooledRedisClientManager: one pointed to your cluster and second to geolocation server and then get clients using manager.GetClient() for the redis server you need to interact. Each PooledRedisClientManager works independently and you can use it for your task.

//Put this in inititializing code, which executes only once
var cluster = new PooledRedisClientManager(...);
var geo = new PooledRedisClientManager(...);

//this code can be executed for every request
using (var client = cluster.GetClient())
{
   //perform operations with cluster redis instance
}

using (var client = geo.GetClient())
{
  //perform operations with geo redis instance
}

It seems to work when I try it.

I see in the code there is a static RedisState class, which would be shared between all pools.

I don’t know if there is anything in there which could cause a problem.

RedisState counts general statistics and disposes underlying connection of client when client returned to the pool not used for a long period of time. So it is a PooledRedisClientManaged-safe class (name in analogy with thread-safe classes).