redisSetContext
Get or set the current active Redis connection environment.
redisSetContext( e = NULL) redisGetContext()
e |
An environment representing the new Redis server connection context
returned by |
The rredis package stores information associated with a connection to
a Redis server in an environment. The redisSetContext
and
redisSetContext
functions help manage simultaneous
connection to multiple Redis servers.
The redisSetContext
function returns an environment representing
the current active Redis connection. If there is no current active Redis
connection, an environment is still returned, but without connection
information.
The redisSetContext
function replaces the current active environment.
Any number of simultaneous connections to multiple Redis servers may be managed
in this manner.
NULL is invisibly returned.
B. W. Lewis
## Not run: # Open a connection to a Redis server on HOST1 and store its context: HOST1 <- redisConnect(host='HOST1', returnRef=TRUE) print(redisInfo()) # Initiate a new Redis context: HOST2 <- redisConnect(host='HOST2', returnRef=TRUE) # The connection to HOST2 is now active: print(redisInfo()) # We may now switch back and forth between the two active connections: redisSetContext(HOST1) print(redisInfo()) redisSetContext(HOST2) print(redisInfo()) redisClose() redisSetContext(HOST1) redisClose() ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.