Skip to content

Commit 6ebeaac

Browse files
committed
Document all options
1 parent 2ab0517 commit 6ebeaac

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/redis.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ def self.current=(redis)
2626

2727
include MonitorMixin
2828

29+
# Create a new client instance
30+
#
31+
# @param [Hash] options
32+
# @option options [String] :url (value of the environment variable REDIS_URL) a Redis url, for a TCP connection: `redis://:[password]@[hostname]:[port]/[db]` (password, port and database are optional), for a unix socket connection: `unix://[path to Redis socket]`. This overrides all other options.
33+
# @option options [String] :host ("127.0.0.1") server hostname
34+
# @option options [Fixnum] :port (6379) server port
35+
# @option options [String] :path path to server socket (overrides host and port)
36+
# @option options [Float] :timeout (5.0) timeout in seconds
37+
# @option options [Float] :connect_timeout (same as timeout) timeout for initial connect in seconds
38+
# @option options [String] :password Password to authenticate against server
39+
# @option options [Fixnum] :db (0) Database to select after initial connect
40+
# @option options [Symbol] :driver Driver to use, currently supported: `:ruby`, `:hiredis`
41+
# @option options [String] :id ID for the client connection, assigns name to current connection by sending `CLIENT SETNAME`
42+
# @option options [Hash, Fixnum] :tcp_keepalive Keepalive values, if Fixnum `intvl` and `probe` are calculated based on the value, if Hash `time`, `intvl` and `probes` can be specified as a Fixnum
43+
# @option options [Fixnum] :reconnect_attempts Number of attempts trying to connect
44+
# @option options [Boolean] :inherit_socket (false) Whether to use socket in forked process or not
45+
# @option options [Array] :sentinels List of sentinels to contact
46+
# @option options [Symbol] :role (:master) Role to fetch via Sentinel, either `:master` or `:slave`
47+
#
48+
# @return [Redis] a new client instance
2949
def initialize(options = {})
3050
@options = options.dup
3151
@original_client = @client = Client.new(options)

0 commit comments

Comments
 (0)