Class: Redis::Client::ThreadSafe

Inherits:
Redis::Client show all
Defined in:
lib/redis/client.rb

Instance Attribute Summary

Attributes inherited from Redis::Client

#connection, #db, #host, #logger, #password, #port, #timeout

Instance Method Summary collapse

Methods inherited from Redis::Client

#call, #call_loop, #call_pipelined, #call_without_timeout, #connect, #connected?, #disconnect, #id, #process, #read, #reconnect, #without_socket_timeout

Constructor Details

#initialize(*args) ⇒ ThreadSafe



168
169
170
171
172
173
# File 'lib/redis/client.rb', line 168

def initialize(*args)
  require "monitor"

  super(*args)
  @mutex = ::Monitor.new
end

Instance Method Details

#ensure_connected(&block) ⇒ Object



179
180
181
# File 'lib/redis/client.rb', line 179

def ensure_connected(&block)
  synchronize { super }
end

#synchronize(&block) ⇒ Object



175
176
177
# File 'lib/redis/client.rb', line 175

def synchronize(&block)
  @mutex.synchronize(&block)
end