redis_config: Redis configuration

Description Usage Arguments Details Examples

View source: R/config.R

Description

Create a set of valid Redis configuration options.

Usage

1
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 or NULL).

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).

The way that configuration options are resolved follows the design for redis-rb very closely.

  1. First, look up (and parse if found) the REDIS_URL environment variable and override defaults with that.

  2. Any arguments given (host, port, password, db) override values inferred from the url or defaults.

  3. If path is given, that overrides the host/port settings and a socket connection will be used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# default config:
redis_config()

# set values
redis_config(host="myhost")

# url settings:
redis_config(url="redis://:[email protected]:32000/2")

# override url settings:
redis_config(url="redis://myhost:32000", port=31000)
redis_config(url="redis://myhost:32000", path="/tmp/redis.conf")

ropensci/RedisAPI documentation built on May 16, 2018, 6:58 a.m.