Home > Redis > Redis Learning Note – 06 Command in Redis (Set)

Redis Learning Note – 06 Command in Redis (Set)

Unordered collection of unique strings

SADD key member [member …]
Add the specified members to the set stored at key.
SREM key member [member …]
Remove the specified members from the set stored at key.
SCARD key
Returns the set cardinality (number of elements) of the set stored at key.
SMEMBERS key
Returns all the members of the set value stored at key.

01

SISMEMBER key member
Returns if member is a member of the set stored at key.
02

SRANDMEMBER key [count]
Return a random element from the set value stored at key. If called with a negative count the behavior changes and the command is allowed to return the same element multiple times.
03

SPOP key
Removes and returns a random element from the set value stored at key.
04

SMOVE source destination member
Move member from the set at source to the set at destination.
05

SDIFF key [key …]
Returns the members of the set resulting from the difference between the first set and all the successive sets.
SDIFFSTORE destination key [key …]
This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
If destination already exists, it is overwritten.
07

SDIFF key [key …]
Returns the members of the set resulting from the difference between the first set and all the successive sets.
SDIFFSTORE destination key [key …]
This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
If destination already exists, it is overwritten.
08

SUNION key [key …]
Returns the members of the set resulting from the union of all the given sets.
SUNIONSTORE destination key [key …]
This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.
If destination already exists, it is overwritten.
09

Source: http://redis.io/commands#set

Categories: Redis
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: