Module: RedisClient::Common
- Included in:
- RedisClient, Pooled
- Defined in:
- lib/redis_client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#connect_timeout ⇒ Object
Returns the value of attribute connect_timeout.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#write_timeout ⇒ Object
Returns the value of attribute write_timeout.
Instance Method Summary collapse
- #initialize(config, id: config.id, connect_timeout: config.connect_timeout, read_timeout: config.read_timeout, write_timeout: config.write_timeout) ⇒ Object
- #node_for(_key) ⇒ Object
- #nodes_for(*keys) ⇒ Object
- #timeout=(timeout) ⇒ Object
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
64 65 66 |
# File 'lib/redis_client.rb', line 64 def config @config end |
#connect_timeout ⇒ Object
Returns the value of attribute connect_timeout.
65 66 67 |
# File 'lib/redis_client.rb', line 65 def connect_timeout @connect_timeout end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
64 65 66 |
# File 'lib/redis_client.rb', line 64 def id @id end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
64 65 66 |
# File 'lib/redis_client.rb', line 64 def nodes @nodes end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
65 66 67 |
# File 'lib/redis_client.rb', line 65 def read_timeout @read_timeout end |
#write_timeout ⇒ Object
Returns the value of attribute write_timeout.
65 66 67 |
# File 'lib/redis_client.rb', line 65 def write_timeout @write_timeout end |
Instance Method Details
#initialize(config, id: config.id, connect_timeout: config.connect_timeout, read_timeout: config.read_timeout, write_timeout: config.write_timeout) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/redis_client.rb', line 67 def initialize( config, id: config.id, connect_timeout: config.connect_timeout, read_timeout: config.read_timeout, write_timeout: config.write_timeout ) @config = config @id = id&.to_s @connect_timeout = connect_timeout @read_timeout = read_timeout @write_timeout = write_timeout @command_builder = config.command_builder @pid = PIDCache.pid @nodes = [self].freeze end |
#node_for(_key) ⇒ Object
88 89 90 |
# File 'lib/redis_client.rb', line 88 def node_for(_key) self end |
#nodes_for(*keys) ⇒ Object
92 93 94 95 |
# File 'lib/redis_client.rb', line 92 def nodes_for(*keys) keys.flatten! { self => keys } end |
#timeout=(timeout) ⇒ Object
84 85 86 |
# File 'lib/redis_client.rb', line 84 def timeout=(timeout) @connect_timeout = @read_timeout = @write_timeout = timeout end |