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.
10 11 12 13 14 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 10 def initialize(client, queue) @client = client @worker = nil @queue = queue end |
Instance Method Details
#call(command) ⇒ Object
16 17 18 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 16 def call(command) @client.call_v(command) end |
#close ⇒ Object
24 25 26 27 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 24 def close @worker.exit if @worker&.alive? @client.close end |
#ensure_worker ⇒ Object
20 21 22 |
# File 'lib/redis_client/cluster/pub_sub.rb', line 20 def ensure_worker @worker = spawn_worker(@client, @queue) unless @worker&.alive? end |