1. 5 data types of redis:
string string (can be integer, floating point and string, collectively called elements)
list list (implementation Queue, elements are not unique, first-in-first-out principle)
set set (different elements)
hash hash value (hash key must be unique)
sort set ordered set
Recommended (free): redis tutorial
2. Common commands for string type:
Self-increment: incr
Self-decrement: decr
Add: incrby
Subtract: decrby
3. Common commands supported by list type:
lpush: push from the left
lpop: pop from the right
rpush: Push from the right
rpop: Pop from the right
llen: Check the length of a list data type
4. Common commands supported by the set type:
sadd: Add data
scard: Check the number of elements existing in the set data
sismember: Determine whether an element exists in the set data
srem: Delete an element in a set data
5. Common commands supported by hash data type:
hset: Add hash data
hget: Get hash data
hmget: Get multiple hash data
6 , sort set is very similar to hash, and is also a mapping form of storage:
zadd: add
zcard: query
zrange: data sorting
The above is the detailed content of Take a look at the 5 data types of redis. For more information, please follow other related articles on the PHP Chinese website!