Learn R Programming

rredis (version 1.7.0)

redisSetPipeline: Set the Redis message blocking state.

Description

Use redisSetBlocking to set the rredis client to blocking (default) or non-blocking Redis communication mode.

Usage

redisSetBlocking( value = TRUE ) redisSetPipeline( value = FALSE )

Arguments

value
TRUE indicates Redis pipelined mode, FALSE non-pipelined mode. Just to be extra confusing, it's the opposite for the older, now deprecated function redisSetBlocking. Just use the new redisSetPipeline.

Value

The new pipeline mode (TRUE/FALSE) is invisibly returned.

Details

The rredis client blocks for a response from a connected Redis server after each transaction in non-pipelined mode (the default). When in pipelined mode, transactions are issued without servicing Redis server responses, and server responses must be manually serviced with the redisGetResponse function.

Pipelined mode can improve performance in some circumstances like lots of repeated redisSet operations. When using pipelined mode, don't forget to periodically service responses from the Redis server (results are cached on the server until requested).

Note that use of commands like redisMSet can sometimes obviate the need to use non-blocking mode.

See Also

redisGetResponse

Examples

Run this code
## Not run: 
# redisConnect()
# redisSetBlocking(FALSE)
# redisLPush('x',pi)
# redisLPush('x',exp(1))
# redisGetResponse()
# redisSetBlocking(TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab