A Redis connection pool using Redic.
Ruby
Latest commit 1211eb3 Apr 6, 2015 @djanowski Release.
Permalink
Failed to load latest commit information.
lib/redic
test
.gitignore
CHANGELOG.md
README.md
UNLICENSE
rakefile
redic-pool.gemspec

README.md

Redic::Pool

A Redis connection pool using Redic.

Usage

require "redic/pool"

$redis = Redic::Pool.new("redis://localhost:6379", size: 10)

Array.new(100) do
  Thread.new do
    $redis.call("GET", "foo")
  end
end.each(&:join)

$redis.call("INFO", "clients")[/connected_clients:(\d+)/, 1]
# => "10"

With Ohm

Assuming you use Ohm 2.0+:

require "redic/pool"
require "ohm"

Ohm.redis = Redic::Pool.new(ENV["REDIS_URL"], size: 10)