Class: RedisClient::Cluster::PubSub

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_client/cluster.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PubSub

Returns a new instance of PubSub.



71
72
73
74
# File 'lib/redis_client/cluster.rb', line 71

def initialize(client)
  @client = client
  @pubsub = nil
end

Instance Method Details

#call(*command, **kwargs) ⇒ Object



76
77
78
79
80
# File 'lib/redis_client/cluster.rb', line 76

def call(*command, **kwargs)
  close
  @pubsub = @client.send(:assign_node, *command).pubsub
  @pubsub.call(*command, **kwargs)
end

#closeObject



82
83
84
85
# File 'lib/redis_client/cluster.rb', line 82

def close
  @pubsub&.close
  @pubsub = nil
end

#next_event(timeout = nil) ⇒ Object



87
88
89
# File 'lib/redis_client/cluster.rb', line 87

def next_event(timeout = nil)
  @pubsub&.next_event(timeout)
end