Class: Redis::Client::ThreadSafe

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

Constant Summary

Constants inherited from Redis::Client

ASTERISK, COLON, DOLLAR, MINUS, PLUS

Instance Attribute Summary

Attributes inherited from Redis::Client

#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

Returns a new instance of ThreadSafe.



254
255
256
257
258
259
# File 'lib/redis/client.rb', line 254

def initialize(*args)
  require "monitor"

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

Instance Method Details

#ensure_connected(&block) ⇒ Object



265
266
267
# File 'lib/redis/client.rb', line 265

def ensure_connected(&block)
  synchronize { super }
end

#synchronize(&block) ⇒ Object



261
262
263
# File 'lib/redis/client.rb', line 261

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