class Redis::Client
def blocking_call_v(timeout, command, &block)
def blocking_call_v(timeout, command, &block) if timeout && timeout > 0 # Can't use the command timeout argument as the connection timeout # otherwise it would be very racy. So we add an extra 100ms to account for # the network delay. timeout += 0.1 end super(timeout, command, &block) rescue ::RedisClient::Error => error raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace end
def call_v(command, &block)
def call_v(command, &block) super(command, &block) rescue ::RedisClient::Error => error raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace end
def config(**kwargs)
def config(**kwargs) super(protocol: 2, **kwargs) end
def db
def db config.db end
def disable_reconnection(&block)
def disable_reconnection(&block) ensure_connected(retryable: false, &block) end
def ensure_connected(retryable: true)
def ensure_connected(retryable: true) unless @inherit_socket || Process.pid == @pid raise InheritedError, "Tried to use a connection from a child process without reconnecting. " \ "You need to reconnect to Redis after forking " \ "or set :inherit_socket to true." end super end
def host
def host config.host unless config.path end
def id
def id config.id end
def inherit_socket!
def inherit_socket! @inherit_socket = true end
def initialize(*)
def initialize(*) super @inherit_socket = false @pid = Process.pid end
def multi
def multi super rescue ::RedisClient::Error => error raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace end
def password
def password config.password end
def path
def path config.path end
def pipelined
def pipelined super rescue ::RedisClient::Error => error raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace end
def port
def port config.port unless config.path end
def sentinel(**kwargs)
def sentinel(**kwargs) super(protocol: 2, **kwargs) end
def server_url
def server_url config.server_url end
def timeout
def timeout config.read_timeout end
def username
def username config.username end