Sha256: 9187de73d3536512f8725e3d00689df60b06d02faed1f3de3e91c377660609e0

Contents?: true

Size: 358 Bytes

Versions: 1

Compression:

Stored size: 358 Bytes

Contents

require "connection_pool"
require "redic"

class Redic::Pool
  VERSION = "0.1.0"

  attr :pool

  def initialize(url, options = {})
    @pool = ConnectionPool.new(size: options.fetch(:size, 10)) { Redic.new(url) }
  end

  def call(*args)
    @pool.with do |client|
      client.call(*args)
    end
  end

  def with(&block)
    @pool.with(&block)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redic-pool-0.1.0 lib/redic/pool.rb