class Redis::Client
Constants
- ERROR_MAPPING
Public Class Methods
config(**kwargs)
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 22 def config(**kwargs) super(protocol: 2, **kwargs) end
sentinel(**kwargs)
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 26 def sentinel(**kwargs) super(protocol: 2, **kwargs) end
Public Instance Methods
blocking_call_v(timeout, command, &block)
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 78 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 translate_error!(error) end
call_v(command, &block)
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 72 def call_v(command, &block) super(command, &block) rescue ::RedisClient::Error => error translate_error!(error) end
db()
click to toggle source
# File lib/redis/client.rb, line 43 def db config.db end
disable_reconnection(&block)
click to toggle source
# File lib/redis/client.rb, line 103 def disable_reconnection(&block) ensure_connected(retryable: false, &block) end
host()
click to toggle source
# File lib/redis/client.rb, line 47 def host config.host unless config.path end
id()
click to toggle source
# File lib/redis/client.rb, line 31 def id config.id end
inherit_socket!()
click to toggle source
# File lib/redis/client.rb, line 107 def inherit_socket! @inherit_socket = true end
multi()
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 97 def multi super rescue ::RedisClient::Error => error translate_error!(error) end
password()
click to toggle source
# File lib/redis/client.rb, line 63 def password config.password end
path()
click to toggle source
# File lib/redis/client.rb, line 55 def path config.path end
pipelined()
click to toggle source
Calls superclass method
# File lib/redis/client.rb, line 91 def pipelined super rescue ::RedisClient::Error => error translate_error!(error) end
port()
click to toggle source
# File lib/redis/client.rb, line 51 def port config.port unless config.path end
server_url()
click to toggle source
# File lib/redis/client.rb, line 35 def server_url config.server_url end
timeout()
click to toggle source
# File lib/redis/client.rb, line 39 def timeout config.read_timeout end
username()
click to toggle source
# File lib/redis/client.rb, line 59 def username config.username end
Private Instance Methods
translate_error!(error)
click to toggle source
# File lib/redis/client.rb, line 113 def translate_error!(error) redis_error = translate_error_class(error.class) raise redis_error, error.message, error.backtrace end
translate_error_class(error_class)
click to toggle source
# File lib/redis/client.rb, line 118 def translate_error_class(error_class) ERROR_MAPPING.fetch(error_class) rescue IndexError if (client_error = error_class.ancestors.find { |a| ERROR_MAPPING[a] }) ERROR_MAPPING[error_class] = ERROR_MAPPING[client_error] else raise end end