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.



64
65
66
# File 'lib/redis_client.rb', line 64

def config
  @config
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



65
66
67
# File 'lib/redis_client.rb', line 65

def connect_timeout
  @connect_timeout
end

#idObject (readonly)

Returns the value of attribute id.



64
65
66
# File 'lib/redis_client.rb', line 64

def id
  @id
end

#read_timeoutObject

Returns the value of attribute read_timeout.



65
66
67
# File 'lib/redis_client.rb', line 65

def read_timeout
  @read_timeout
end

#write_timeoutObject

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
# 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
end

#timeout=(timeout) ⇒ Object



83
84
85
# File 'lib/redis_client.rb', line 83

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