class Redis::Pool
Constants
- VERSION
Attributes
pool[R]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/redis/pool.rb, line 9 def initialize(options = {}) @pool = ConnectionPool.new(size: options.delete(:size)) { Redis::Client.new(options) } @id = "Redis::Pool::#{object_id}" super end
Public Instance Methods
multi()
click to toggle source
Calls superclass method
# File lib/redis/pool.rb, line 38 def multi raise ArgumentError, "Redis::Pool#multi can only be called with a block" unless block_given? super end
pipelined() { |client| ... }
click to toggle source
# File lib/redis/pool.rb, line 26 def pipelined pipeline = Pipeline.new _with_client(pipeline) do |client| yield(client) end synchronize do |client| client.call_pipeline(pipeline) end end
synchronize() { |current| ... }
click to toggle source
# File lib/redis/pool.rb, line 16 def synchronize if current = Thread.current[@id] yield(current) else @pool.with do |client| _with_client(client) { yield(client) } end end end
Protected Instance Methods
_with_client(client) { |client| ... }
click to toggle source
# File lib/redis/pool.rb, line 45 def _with_client(client) old, Thread.current[@id] = Thread.current[@id], client yield(client) ensure Thread.current[@id] = old end