1. 5 data types of redis:
string string (can They are integers, floating point types and strings, collectively referred to as elements)
list list (implementation of queue, elements are not unique, first-in-first-out principle)
set set (different elements)
hash hash scatter Column value (hash key must be unique)
sort set ordered set
Recommended (free):redis
##2 Common commands of .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 elements
srem: Delete elements in a certain 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
string string (can They are integers, floating point types and strings, collectively referred to as elements)
list list (implementation of queue, elements are not unique, first-in-first-out principle)
set set (different elements)
hash hash scatter Column value (hash key must be unique)
sort set ordered set
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: From Right change and push
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 present 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 and Hash is very similar and is also stored in the form of mapping:
zadd: add
zcard: query
zrange: data sorting
The above is the detailed content of An in-depth explanation of the 5 data types of redis. For more information, please follow other related articles on the PHP Chinese website!