redisConnect: Connect to a Redis server.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/controlCMD.R

Description

Connect to an available Redis server on the specified port.

Usage

1
2
redisConnect(host = "localhost", port = 6379, password = NULL,
             returnRef = FALSE, nodelay=TRUE, timeout=86400L, closeExisting=TRUE)

Arguments

host

The Redis server host name or inet address (optional, character). The default value is "localhost".

port

The Redis port number (optional, numeric or integer). The default value is 6379L.

password

Redis authentication password.

returnRef

Set returnRef=TRUE to return the environment that contains the Redis connection state (see details). The default value is FALSE.

nodelay

No longer used, always TRUE.

timeout

Set the R connection timeout (in seconds). Beware that some OSes may treat very large values as zero: however the POSIX standard requires values up to 31 days to be supported.

closeExisting

Set to FALSE to keep any existing Redis connection open (for use with setContext).

Details

A running instance of a Redis server is required. Use returnRef to return the Redis connection state in an environment. Then use the redisSetContext function to switch environment state and manage multiple open Redis connections.

Note that Redis pipelining can increase performance: redisSetPipeline(TRUE) (q.v.).

Value

Nothing is returned by default. Errors are displayed if the function fails to connect to the specified Redis server. Disconnect from a connected server with redisClose.

If returnRef is set to TRUE and no error occurs, a list describing the Redis connection will be returned. A future version of the package will use this feature to support multiple Redis connections with the attachRedis function.

Author(s)

B. W. Lewis

References

http://redis.io/commands

See Also

redisClose redisGetContext redisSetContext redisSetPipeline redisGetResponse

Examples

1
2
3
4
5
6
7
## Not run: 
redisConnect()
redisSet('x',runif(5))
redisGet('x')
redisClose()

## End(Not run)

bwlewis/rredis documentation built on Jan. 3, 2022, 4:53 p.m.