Redis serviceStack pooled connection client

后端 未结 1 1567
遇见更好的自我
遇见更好的自我 2021-02-15 04:00

I\'m designing a web service which uses Redis as a database, and I want to know the best practices for using Redis connecting with StackService client.

The point is that

相关标签:
1条回答
  • 2021-02-15 04:43

    I used PooledRedisClientManager and it works fine:

    Sample code that I run only once:

    static PooledRedisClientManager pooledClientManager = new PooledRedisClientManager("localhost");
    

    and code I run on many threads:

    var redisClient = pooledClientManager.GetClient();
    using (redisClient)
    {
        redisClient.Set("key" + i.ToString(), "value1");
    }
    

    and I have only 11 clients connected to the server.

    0 讨论(0)
提交回复
热议问题