class Redis
def initialize(options = {})
-
(Redis)
- a new client instance
Options Hash:
(**options)
-
:connector
(Class
) -- Class of custom connector -
:replica
(Boolean
) -- Whether to use readonly replica nodes in Redis Cluster or not -
:cluster
(Array
) -- List of cluster nodes to contactString, Integer}> -
:role
(Symbol
) -- Role to fetch via Sentinel, either `:master` or `:slave` -
:sentinels
(Array
) -- List of sentinels to contact -
:inherit_socket
(Boolean
) -- Whether to use socket in forked process or not -
:reconnect_attempts
(Integer
) -- Number of attempts trying to connect -
:tcp_keepalive
(Hash, Integer
) -- Keepalive values, if Integer `intvl` and `probe` are calculated -
:id
(String
) -- ID for the client connection, assigns name to current connection by sending -
:driver
(Symbol
) -- Driver to use, currently supported: `:ruby`, `:hiredis`, `:synchrony` -
:db
(Integer
) -- Database to select after initial connect -
:password
(String
) -- Password to authenticate against server -
:username
(String
) -- Username to authenticate against server -
:connect_timeout
(Float
) -- timeout for initial connect in seconds -
:timeout
(Float
) -- timeout in seconds -
:path
(String
) -- path to server socket (overrides host and port) -
:port
(Integer
) -- server port -
:host
(String
) -- server hostname -
:url
(String
) -- a Redis URL, for a TCP connection:
Parameters:
-
options
(Hash
) --
def initialize(options = {}) @options = options.dup @cluster_mode = options.key?(:cluster) client = @cluster_mode ? Cluster : Client @original_client = @client = client.new(options) @queue = Hash.new { |h, k| h[k] = [] } super() # Monitor#initialize end