This article will introduce you to the five data types of redis. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
1. 5 data types of redis:
string string (can be integer, floating point and string , 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
[Related recommendations: Redis video tutorial]
2. Commonly used commands for string types:
Self-increment: incr
Self-decrement: decr
Add: incrby
Decrease: 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 certain 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. Commonly used hash data types supported Command:
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
#For more programming related knowledge, please visit: Programming Video! !
The above is the detailed content of A brief discussion on the 5 data types of redis. For more information, please follow other related articles on the PHP Chinese website!