redis_config: Redis configuration

View source: R/config.R

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

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.

  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

# 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")

redux documentation built on May 29, 2024, 6:15 a.m.