redisSet: Store a value in Redis.

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

View source: R/strValCMD.R

Description

Store a value identified by a character key name in the Redis database. Any existing value with the same key will be replaced by the new value unless NX is set to TRUE.

Usage

1
redisSet(key, value, NX = FALSE)

Arguments

key

The (required) character identifier for the value to be stored.

value

The (required) object to associate with the key.

NX

If NX = TRUE, existing values will not be replaced.

Details

The value is copied to the Redis server. The value to be stored can be any serializable R object up to the Redis maximum object size (excluding, for example, external pointer references). References to other R objects or environments inside the value are not guaranteed to be preserved.

In order to store strings that can easily be read by other clients, first convert the character object using the charToRaw function as shown in the examples.

Value

The value “OK” is returned upon success (conforming to the usual Redis behavior).

Author(s)

B. W. Lewis

References

http://redis.io/commands

See Also

redisGet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# Store an R object with the key 'x':
redisSet('x',runif(5))

## End(Not run)
## Not run: 
# Store a string that can be easily read by other clients:
redisSet('x',charToRaw('Hello Redis clients'))

## End(Not run)

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