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 the regular read_timeout on top # to account for the network delay. timeout += config.read_timeout end super(timeout, command, &block) rescue ::RedisClient::Error => error Client.translate_error!(error) end
def call_v(command, &block)
def call_v(command, &block) super(command, &block) rescue ::RedisClient::Error => error Client.translate_error!(error) end
def config(**kwargs)
def config(**kwargs) super(protocol: 2, **kwargs) end
def db
def db config.db 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 multi(watch: nil)
def multi(watch: nil) super rescue ::RedisClient::Error => error Client.translate_error!(error) end
def password
def password config.password end
def path
def path config.path end
def pipelined(exception: true)
def pipelined(exception: true) super rescue ::RedisClient::Error => error Client.translate_error!(error) end
def port
def port config.port unless config.path end
def sentinel(**kwargs)
def sentinel(**kwargs) super(protocol: 2, **kwargs, client_implementation: ::RedisClient) end
def server_url
def server_url config.server_url end
def timeout
def timeout config.read_timeout end
def translate_error!(error, mapping: ERROR_MAPPING)
def translate_error!(error, mapping: ERROR_MAPPING) redis_error = translate_error_class(error.class, mapping: mapping) raise redis_error, error.message, error.backtrace end
def translate_error_class(error_class, mapping: ERROR_MAPPING)
def translate_error_class(error_class, mapping: ERROR_MAPPING) mapping.fetch(error_class) rescue IndexError if (client_error = error_class.ancestors.find { |a| mapping[a] }) mapping[error_class] = mapping[client_error] else raise end end
def username
def username config.username end