set
- Sadd myset “STR “– Insert data
- Smenbers mySet — View all data
- Sismenber myset “STR “– Checks whether STR is a myset, returns 1 if it is, and 0 if it is not
- Scard myset- Returns the number of elements in myset
- Srandmenber mySet – Returns a random element of myset
- Srandmenber myset n– Returns n elements randomly
- Spop randomly removes an element from mySet
- Smove mySet myset “STR “– Moves the STR element in myset to myset2
- Sdiff mySet myset2 — Returns the different elements of the two collections
- Sinter myset myste2 – Returns the same elements in both sets
- Sunion mySet myset2 – Returns the total elements of the two sets combined
Hash
Format: the key – field – a value
- Hset MyHash Field Value1 — Add a data
- Hget myHash Field — Gets the value of this field
- Hmset myHash field1 value1 field2 value2 — Insert data in batches
- Hmget mthash field1 field2 — Get data in batches
- Hgetall MyHash — Gets all field1 and values
- Hdel myHash field1 — Removes the field of the specified hash
- Hlen myHash – Returns the number of values in the hash
- Hexists myhash field1 — Checks whether field1 in myHash exists
- Hkeys myHash — Returns all fields
- Hvals myHash — Returns all values
- Hincrby myshash field1 1– Field1 increases by 1
- Hdecrby myhash field1 1 –field1 is reduced by 1
- Hsetnx myshash field1 va1 — Add field1 if it does not exist, cannot add if it does
Zset(Ordered set)
- Zadd mySet 1 val1 — Add data
- Zrangebyscore myset -INF + INF — displays all data, from small to large
- Zrangebyscore myset – INF + INF withScore — carries data
- To be continued…