Learn R Programming

rredis (version 1.6.9)

redisSAdd: Add an element to a set.

Description

Add the element to the specified set.

Usage

redisSAdd(set, element)

Arguments

set
The string set identifier.
element
The object to add to the set.

Value

  • TRUE if the element was successfully added, FALSE otherwise (including cases in which the element already belonged to the set).

Details

If member is already a member of the set no operation is performed. If key does not exist a new set with the specified member as sole member is created. If the key exists but does not hold a set value an error is returned.

References

http://redis.io/commands

See Also

redisSRem

Examples

Run this code
redisConnect()
redisSAdd("set", 5)

Run the code above in your browser using DataLab