Class: Redis::Client
- Inherits:
-
RedisClient
- Object
- RedisClient
- Redis::Client
- Defined in:
- lib/redis/client.rb
Constant Summary collapse
- ERROR_MAPPING =
{ RedisClient::ConnectionError => Redis::ConnectionError, RedisClient::CommandError => Redis::CommandError, RedisClient::ReadTimeoutError => Redis::TimeoutError, RedisClient::CannotConnectError => Redis::CannotConnectError, RedisClient::AuthenticationError => Redis::CannotConnectError, RedisClient::FailoverError => Redis::CannotConnectError, RedisClient::PermissionError => Redis::PermissionError, RedisClient::WrongTypeError => Redis::WrongTypeError, RedisClient::ReadOnlyError => Redis::ReadOnlyError, RedisClient::ProtocolError => Redis::ProtocolError, RedisClient::OutOfMemoryError => Redis::OutOfMemoryError, }
Class Method Summary collapse
Instance Method Summary collapse
- #blocking_call_v(timeout, command, &block) ⇒ Object
- #call_v(command, &block) ⇒ Object
- #db ⇒ Object
- #disable_reconnection(&block) ⇒ Object
- #host ⇒ Object
- #id ⇒ Object
- #inherit_socket! ⇒ Object
- #multi ⇒ Object
- #password ⇒ Object
- #path ⇒ Object
- #pipelined ⇒ Object
- #port ⇒ Object
- #server_url ⇒ Object
- #timeout ⇒ Object
- #username ⇒ Object
Class Method Details
.config(**kwargs) ⇒ Object
22 23 24 |
# File 'lib/redis/client.rb', line 22 def config(**kwargs) super(protocol: 2, **kwargs) end |
.sentinel(**kwargs) ⇒ Object
26 27 28 |
# File 'lib/redis/client.rb', line 26 def sentinel(**kwargs) super(protocol: 2, **kwargs) end |
Instance Method Details
#blocking_call_v(timeout, command, &block) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# 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 an extra 100ms to account for # the network delay. timeout += 0.1 end super(timeout, command, &block) rescue ::RedisClient::Error => error translate_error!(error) end |
#call_v(command, &block) ⇒ Object
72 73 74 75 76 |
# File 'lib/redis/client.rb', line 72 def call_v(command, &block) super(command, &block) rescue ::RedisClient::Error => error translate_error!(error) end |
#db ⇒ Object
43 44 45 |
# File 'lib/redis/client.rb', line 43 def db config.db end |
#disable_reconnection(&block) ⇒ Object
103 104 105 |
# File 'lib/redis/client.rb', line 103 def disable_reconnection(&block) ensure_connected(retryable: false, &block) end |
#host ⇒ Object
47 48 49 |
# File 'lib/redis/client.rb', line 47 def host config.host unless config.path end |
#id ⇒ Object
31 32 33 |
# File 'lib/redis/client.rb', line 31 def id config.id end |
#inherit_socket! ⇒ Object
107 108 109 |
# File 'lib/redis/client.rb', line 107 def inherit_socket! @inherit_socket = true end |
#multi ⇒ Object
97 98 99 100 101 |
# File 'lib/redis/client.rb', line 97 def multi super rescue ::RedisClient::Error => error translate_error!(error) end |
#password ⇒ Object
63 64 65 |
# File 'lib/redis/client.rb', line 63 def password config.password end |
#path ⇒ Object
55 56 57 |
# File 'lib/redis/client.rb', line 55 def path config.path end |
#pipelined ⇒ Object
91 92 93 94 95 |
# File 'lib/redis/client.rb', line 91 def pipelined super rescue ::RedisClient::Error => error translate_error!(error) end |
#port ⇒ Object
51 52 53 |
# File 'lib/redis/client.rb', line 51 def port config.port unless config.path end |
#server_url ⇒ Object
35 36 37 |
# File 'lib/redis/client.rb', line 35 def server_url config.server_url end |
#timeout ⇒ Object
39 40 41 |
# File 'lib/redis/client.rb', line 39 def timeout config.read_timeout end |
#username ⇒ Object
59 60 61 |
# File 'lib/redis/client.rb', line 59 def username config.username end |