PageRenderTime 34ms CodeModel.GetById 21ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/man/redisSetContext.Rd

http://github.com/bwlewis/rredis
Unknown | 62 lines | 58 code | 4 blank | 0 comment | 0 complexity | 28aea4679b220181e6e39d3cfa1c758a MD5 | raw file
 1\name{redisSetContext}
 2\alias{redisSetContext}
 3\alias{redisGetContext}
 4\title{redisSetContext}
 5\description{Get or set the current active Redis connection environment.}
 6\usage{
 7redisSetContext( e = NULL)
 8redisGetContext()
 9}
10\arguments{
11  \item{e}{
12    An environment representing the new Redis server connection context
13returned by \code{rediscConnect(returnRef=TRUE)}. The default value of NULL
14sets the context to the most recently established connection.
15  }
16}
17\details{
18The rredis package stores information associated with a connection to
19a Redis server in an environment. The \code{redisSetContext} and
20\code{redisSetContext} functions help manage simultaneous
21connection to multiple Redis servers.
22
23The \code{redisSetContext} function returns an environment representing
24the current active Redis connection. If there is no current active Redis
25connection, an environment is still returned, but without connection
26information.
27
28The \code{redisSetContext} function replaces the current active environment.
29Any number of simultaneous connections to multiple Redis servers may be managed
30in this manner.
31}
32\value{
33NULL is invisibly returned.
34}
35\author{
36B. W. Lewis
37}
38\seealso{
39\code{\link{redisGetContext}}
40\code{\link{redisConnect}}
41}
42\examples{
43\dontrun{
44# Open a connection to a Redis server on HOST1 and store its context:
45HOST1 <- redisConnect(host='HOST1', returnRef=TRUE)
46print(redisInfo())
47
48# Initiate a new Redis context:
49HOST2 <- redisConnect(host='HOST2', returnRef=TRUE)
50# The connection to HOST2 is now active:
51print(redisInfo())
52
53# We may now switch back and forth between the two active connections:
54redisSetContext(HOST1)
55print(redisInfo())
56redisSetContext(HOST2)
57print(redisInfo())
58redisClose()
59redisSetContext(HOST1)
60redisClose()
61}
62}