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.
266 267 268 269 270 271 |
# File 'lib/redis/client.rb', line 266 def initialize(*args) require "monitor" super(*args) @mutex = ::Monitor.new end |
Instance Method Details
#ensure_connected(&block) ⇒ Object
277 278 279 280 281 |
# File 'lib/redis/client.rb', line 277 def ensure_connected(&block) super do synchronize(&block) end end |
#synchronize(&block) ⇒ Object
273 274 275 |
# File 'lib/redis/client.rb', line 273 def synchronize(&block) @mutex.synchronize(&block) end |