class Redis::PooledClient
- Redis::PooledClient
- Reference
- Object
Overview
A Redis client object that can be shared across multiple fibers.
It is backed by a connection pool of Redis instances and will automatically allocate and free these instances from/to the pool, per command.
Example usage:
redis = Redis::PooledClient.new(host: ..., port: ..., ..., pool_size: 5)
10.times do |i|
  spawn do
    redis.set("foo#{i}", "bar")
    redis.get("foo#{i}") # => "bar"
  end
endHere 10 fibers access the same Redis::PooledClient instance while automatically sharing 5 Redis connections.
Defined in:
redis/pooled_client.crConstructors
- 
        .new(*args, pool_size = 5, pool_timeout = 5.0, **args2)
        
          Accepts the same connection parameters like a Redisinstance, plus the documented ones.
Instance Method Summary
- 
        #pool : ConnectionPool(Redis)
        
          The connection pool. 
- #psubscribe(*channel_patterns, &callback_setup_block : Redis::Subscription -> )
- #subscribe(*channels, &callback_setup_block : Redis::Subscription -> )
Macro Summary
Constructor Detail
Accepts the same connection parameters like a Redis instance, plus the documented ones.
- pool_size - the number of Redisto hold in the connection pool.
- pool_timeout - the time to wait for a Redisinstance to become available from the pool before dying withRedis::PoolTimeoutError.
Instance Method Detail
The connection pool. See https://github.com/ysbaddaden/pool