PooledRedisClientManager not releasing connections

前端 未结 2 1860
无人共我
无人共我 2021-02-10 16:37

I am storing lists of json data in redis and accessing it using the ServiceStack c# client. I am essentially managing my own foreign keys, where I store a zrange o

2条回答
  •  无人及你
    2021-02-10 17:16

    edit The below approach is not recommended - you should take a dependency on the IRedisClientsManager and wrap all redis client calls inside a using() block, otherwise you will be bitten by gremlins.

    I've been having similar problems getting Windsor to play nicely with the PooledRedisClientsManager, in the end this seemed to work:

            container.Register(
                Component.For()
                         .Instance(redisClients)
                         .LifestyleSingleton(),
    
                Component.For()
                         .UsingFactoryMethod(c => c.Resolve().GetClient(),
                                            managedExternally: true));
        }
    

    The managedExternally parameter tells Windsor to not try to apply decommissioning concerns to the IRedisClients and let the PooledRedisClientsManager handle recycling.

提交回复
热议问题