set

  1. Sadd myset “STR “– Insert data
  2. Smenbers mySet — View all data
  3. Sismenber myset “STR “– Checks whether STR is a myset, returns 1 if it is, and 0 if it is not
  4. Scard myset- Returns the number of elements in myset
  5. Srandmenber mySet – Returns a random element of myset
  6. Srandmenber myset n– Returns n elements randomly
  7. Spop randomly removes an element from mySet
  8. Smove mySet myset “STR “– Moves the STR element in myset to myset2
  9. Sdiff mySet myset2 — Returns the different elements of the two collections
  10. Sinter myset myste2 – Returns the same elements in both sets
  11. Sunion mySet myset2 – Returns the total elements of the two sets combined

Hash

Format: the key – field – a value

  1. Hset MyHash Field Value1 — Add a data
  2. Hget myHash Field — Gets the value of this field
  3. Hmset myHash field1 value1 field2 value2 — Insert data in batches
  4. Hmget mthash field1 field2 — Get data in batches
  5. Hgetall MyHash — Gets all field1 and values
  6. Hdel myHash field1 — Removes the field of the specified hash
  7. Hlen myHash – Returns the number of values in the hash
  8. Hexists myhash field1 — Checks whether field1 in myHash exists
  9. Hkeys myHash — Returns all fields
  10. Hvals myHash — Returns all values
  11. Hincrby myshash field1 1– Field1 increases by 1
  12. Hdecrby myhash field1 1 –field1 is reduced by 1
  13. Hsetnx myshash field1 va1 — Add field1 if it does not exist, cannot add if it does

Zset(Ordered set)

  1. Zadd mySet 1 val1 — Add data
  2. Zrangebyscore myset -INF + INF — displays all data, from small to large
  3. Zrangebyscore myset – INF + INF withScore — carries data
  4. To be continued…