Module: RedisClient::Common

Included in:
RedisClient, Pooled
Defined in:
lib/redis_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



56
57
58
# File 'lib/redis_client.rb', line 56

def config
  @config
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



57
58
59
# File 'lib/redis_client.rb', line 57

def connect_timeout
  @connect_timeout
end

#idObject (readonly)

Returns the value of attribute id.



56
57
58
# File 'lib/redis_client.rb', line 56

def id
  @id
end

#read_timeoutObject

Returns the value of attribute read_timeout.



57
58
59
# File 'lib/redis_client.rb', line 57

def read_timeout
  @read_timeout
end

#write_timeoutObject

Returns the value of attribute write_timeout.



57
58
59
# File 'lib/redis_client.rb', line 57

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/redis_client.rb', line 59

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
end

#timeout=(timeout) ⇒ Object



75
76
77
# File 'lib/redis_client.rb', line 75

def timeout=(timeout)
  @connect_timeout = @read_timeout = @write_timeout = timeout
end