Class: RedisClient::Cluster::PubSub::State
- Inherits:
-
Object
- Object
- RedisClient::Cluster::PubSub::State
- Defined in:
- lib/redis_client/cluster/pub_sub.rb
Instance Method Summary collapse
- #call(command) ⇒ Object
- #close ⇒ Object
- #ensure_worker ⇒ Object
-
#initialize(client, queue) ⇒ State
constructor
A new instance of State.
Constructor Details
#initialize(client, queue) ⇒ State
Returns a new instance of State.
9 10 11 12 13 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 9 def initialize(client, queue) @client = client @worker = nil @queue = queue end |
Instance Method Details
#call(command) ⇒ Object
15 16 17 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 15 def call(command) @client.call_v(command) end |
#close ⇒ Object
23 24 25 26 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 23 def close @worker.exit if @worker&.alive? @client.close end |
#ensure_worker ⇒ Object
19 20 21 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 19 def ensure_worker @worker = spawn_worker(@client, @queue) unless @worker&.alive? end |