One: Redis collection (set)
Redis's set is an unordered collection of type string. A collection member is unique, which means that duplicate data cannot appear in the collection.
The collection in Redis is implemented by a hash table, so the complexity of adding, deleting, and finding is O (1).
Two: Set common operations
1) add element to Sadd (name,values) name corresponding collection
2) SCard (name) gets the number of elements in the collection for name
3) Sdiff (keys, *args) The collection of elements in the first name corresponding collection and not in the other name corresponding collection
4) Sdiffstore (dest, keys, *args) Gets the collection that corresponds to the first name and is not in the other name, and then adds it to the dest corresponding collection
5) Sinter (keys, *args) gets the set of one more name corresponding to the set
6) Sinterstore (dest, keys, *args) gets the set of one more name corresponding to the set, and then adds it to the corresponding collection of dest
7) Sismember (name, value) checks if value is a member of the collection that corresponds to name
8) smembers (name) gets all the members of the collection that the name corresponds to
9) smove (SRC, DST, value) move a member from one collection to another collection
Spop (name) removes a member from the right (tail) of the collection and returns it
One) srandmember (name, numbers) randomly gets numbers elements from the collection corresponding to name
Srem (name, values) removes certain values from the collection that corresponds to name
Sunion (keys, *args) gets the set of one more name corresponding to the collection
Sunionstore (Dest,keys, *args) gets the set of one more name corresponding to the collection and saves the result to the corresponding collection of dest
Sscan (name, cursor=0, Match=none, Count=none)
Cache database-redis data types and operations (set)