Class: Redis::Client::ThreadSafe
- Inherits:
-
Redis::Client
- Object
- Redis::Client
- Redis::Client::ThreadSafe
- 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
- #ensure_connected(&block) ⇒ Object
-
#initialize(*args) ⇒ ThreadSafe
constructor
A new instance of ThreadSafe.
- #synchronize(&block) ⇒ Object
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.
263 264 265 266 267 268 |
# File 'lib/redis/client.rb', line 263 def initialize(*args) require "monitor" super(*args) @mutex = ::Monitor.new end |
Instance Method Details
#ensure_connected(&block) ⇒ Object
274 275 276 277 278 |
# File 'lib/redis/client.rb', line 274 def ensure_connected(&block) super do synchronize(&block) end end |
#synchronize(&block) ⇒ Object
270 271 272 |
# File 'lib/redis/client.rb', line 270 def synchronize(&block) @mutex.synchronize(&block) end |