class RedisClient::PubSub

Attributes

raw_connection[R]

Public Class Methods

new(raw_connection, command_builder) click to toggle source
# File lib/redis_client.rb, line 487
def initialize(raw_connection, command_builder)
  @raw_connection = raw_connection
  @command_builder = command_builder
end

Public Instance Methods

call(*command, **kwargs) click to toggle source
# File lib/redis_client.rb, line 492
def call(*command, **kwargs)
  raw_connection.write(@command_builder.generate(command, kwargs))
  nil
end
call_v(command) click to toggle source
# File lib/redis_client.rb, line 497
def call_v(command)
  raw_connection.write(@command_builder.generate(command))
  nil
end
close() click to toggle source
# File lib/redis_client.rb, line 502
def close
  @raw_connection&.close
  @raw_connection = nil # PubSub can't just reconnect
  self
end
next_event(timeout = nil) click to toggle source
# File lib/redis_client.rb, line 508
def next_event(timeout = nil)
  unless raw_connection
    raise ConnectionError, "Connection was closed or lost"
  end

  raw_connection.read(timeout)
rescue ReadTimeoutError
  nil
end