StackExchange.Redis.Pool icon indicating copy to clipboard operation
StackExchange.Redis.Pool copied to clipboard

For StackExchange.Redis add connection pool

StackExchange.Redis.Pool

For StackExchange.Redis connection pool

Build Status

Build Status

Why?

solve timeout prolem:

Was there a big request preceding several small requests to the Redis that timed out? https://github.com/StackExchange/StackExchange.Redis/blob/master/docs/Timeouts.md

How to use

Install

Install-Package StackExchange.Redis.ConnectionPool

Add Dependency Inject

add dependency inject to IServiceCollection

collection.AddRedisConnectionPool("localhost:6379", 10);

OR

collection.AddRedisConnectionPool(option=>{
    // todo config
}, 10);

the more config infomation,look at StackEchange.Redis

doc:https://stackexchange.github.io/StackExchange.Redis/Configuration

if you need one connection object per scope(like one user one request)

direct use inject object: IConnectionMultiplexer

if you need pool (for Parallel case)

use pool object : ObjectPool<PooledConnectionMultiplexer>