redisSetContext(rredis)
redisSetContext()所属R语言包:rredis
redisSetContext
redisSetContext
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Get or set the current active Redis connection environment.
用法----------Usage----------
redisSetContext( e = NULL)
redisGetContext()
参数----------Arguments----------
参数:e
An environment representing the new Redis server connection context returned by rediscConnect(returnRef=TRUE). The default value of NULL sets the context to the most recently established connection.
返回rediscConnect(returnRef=TRUE)新的Redis服务器连接上下文的环境。默认值为NULL的背景下,最近建立的连接设置。
Details
详细信息----------Details----------
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.
“rredis包的信息存储相关联的与一个连接到的Redis服务器的环境中。 redisSetContext和redisSetContext功能帮助管理同时连接到多个Redis的服务器。
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.
redisSetContext函数返回一个代表当前活动的Redis连接的环境。如果有没有当前活跃的Redis连接,仍然返回环境,但不连接信息。
The redisSetContext function replaces the current active environment. Any number of simultaneous connections to multiple Redis servers may be managed in this manner.
redisSetContext函数替换当前的活动环境。任意数量的同时连接到多个Redis的服务器可能会以这种方式进行管理。
值----------Value----------
NULL is invisibly returned.
无形地返回NULL。
(作者)----------Author(s)----------
B. W. Lewis
参见----------See Also----------
redisGetContext redisConnect
redisGetContextredisConnect
实例----------Examples----------
## Not run: [#不运行:]
# Open a connection to a Redis server on HOST1 and store its context:[打开一个连接到HOST1的Redis的服务器上,并保存它的上下文:]
HOST1 <- redisConnect(host='HOST1', returnRef=TRUE)
print(redisInfo())
# Initiate a new Redis context:[启动一个新的Redis的情况下:]
HOST2 <- redisConnect(host='HOST2', returnRef=TRUE)
# The connection to HOST2 is now active:[现在活跃的连接到HOST2的是:]
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)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|