Home  >  Article  >  Database  >  An in-depth explanation of the 5 data types of redis

An in-depth explanation of the 5 data types of redis

coldplay.xixi
coldplay.xixiforward
2021-04-29 18:12:184469browse

An in-depth explanation of the 5 data types of redis

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

An in-depth explanation of the 5 data types of redis 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

An in-depth explanation of the 5 data types of redis 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

An in-depth explanation of the 5 data types of redis 5. Common commands supported by hash data type:
hset: Add hash data
hget: Get hash data
hmget: Get multiple hash data

An in-depth explanation of the 5 data types of redis 6. Sort set is very similar to hash, and is also a mapping form of storage:
zadd: add
zcard: query
zrange :Data sorting

An in-depth explanation of the 5 data types of redis

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

2. Common commands for string type:

Self-increment: incr
Self-decrement: decr
Add: incrby
Subtract: decrby

An in-depth explanation of the 5 data types of redis 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

An in-depth explanation of the 5 data types of redis 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

An in-depth explanation of the 5 data types of redis 5. Common commands supported by hash data type:
hset: Add hash data
hget: Get hash data
hmget: Get multiple hash data

An in-depth explanation of the 5 data types of redis 6.sort set and Hash is very similar and is also stored in the form of mapping:
zadd: add
zcard: query
zrange: data sorting

An in-depth explanation of the 5 data types of redis

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete