redis_config {redux} | R Documentation |
Redis configuration
Description
Create a set of valid Redis configuration options.
Usage
redis_config(..., config = list(...))
Arguments
... |
See Details |
config |
A list of options, to use in place of |
Details
Valid arguments here are:
url
The URL for the Redis server. See examples. (default: Look up environment variable
REDIS_URL
orNULL
).host
The hostname of the Redis server. (default:
127.0.0.1
).port
The port of the Redis server. (default: 6379).
path
The path for a Unix socket if connecting that way.
password
The Redis password (for use with
AUTH
). This will be stored in plain text as part of the Redis object. (default:NULL
).db
The Redis database number to use (for use with
SELECT
. Do not use in a redis clustering context. (default:NULL
; i.e., don't switch).timeout
The maximum number of milliseconds to wait for the connection to be established. (default:
NULL
; i.e. wait forever).
The way that configuration options are resolved follows the design for redis-rb very closely.
First, look up (and parse if found) the
REDIS_URL
environment variable and override defaults with that.Any arguments given (
host
,port
,password
,db
) override values inferred from the url or defaults.If
path
is given, that overrides thehost
/port
settings and a socket connection will be used.
Examples
# default config:
redis_config()
# set values
redis_config(host = "myhost")
# url settings:
redis_config(url = "redis://:p4ssw0rd@myhost:32000/2")
# override url settings:
redis_config(url = "redis://myhost:32000", port = 31000)
redis_config(url = "redis://myhost:32000", path = "/tmp/redis.conf")