Reference Link: http://doc.redisfans.com/set/index.html
Although set and list are similar but there are some differences, such as set in the order of no successive points, so unlike list can be added and deleted data, set will use the hash table to maintain the uniqueness of the string.
Sadd key Member[member ...]
Adds one or more member elements to the collection key, ignoring this element if member already exists, for example: Sadd SK V1 v2 v3 v1.
SCard Key
Returns the number of elements in the set key; Example: SCard sk.
Sdiff Key[key ...]
Gets the set of differences, if the key is 1 returns all members of the collection; Example: Sk1 is the element v1, v2, v3, V4,sk2 is v2, v4, v5 then Sdiff SK Sk1 Return is V1, v3.
Sdiffstore destination Key[key ...]
Similar to Sdiff but Sdiffstore will deposit the difference to the target repository, e.g. Sdiffstore Sk2 SK Sk1.
Sinter Key[key ...]
Gets the intersection of the collection, which is considered an empty set when the key does not exist, and the result is an empty set if there is an empty box in the given collection; Example: Sinter sk1 sk2.
Sinterstore destination Key[key ...]
Similar to sinter but Sinterstore will deposit the intersection into the target library; Sinterstore sk_d sk1 sk2.
Sismember Key Member
Determine if member has returned 0 or 1 in key, example: Sismember SK V1.
Smembers Key
Lists all members of the collection key; Example: Smembers sk.
Smove Source Destination Member
Move element member from source to destination, if member exists in destination only deletes data from source, if source or member does not exist, returns 0. If destination does not exist, it will be created and then manipulated, for example: Smove sk1 sk2 v1.
Spop Key
Removes and returns a random element in the collection that returns NULL when key does not exist; Spop SK.
Srandmember Key[count]
Returns count random elements, count defaults to 1, if count exceeds the set length, returns the entire collection if count is 0, returns an absolute value if count is negative, and the element may be duplicated.
Srem Key Member[member]
Removes one or more member elements in a key, the nonexistent member is ignored; Srem SK V1 v2 v3.
Sunion Key[key ...]
Returns the set of the collection and the nonexistent key is treated as an empty set; Example: Sunion sk1 sk2 sk3.
Sunionstore destination Key[key ...]
Similar to sunion, but Sunionstore will save the data to destination instead of simply returning the collection; for example: Sunionstore SK Sk1 Sk2.
Sscan key Cursor[match Pattern][count Count]
Incremental iteration set, see Scan, Example: Sscan sk1 0 match with 1 count.
Redis Learning Note (vii) BASIC command: set operation