Home  >  Article  >  Database  >  Take a look at the 5 data types of redis

Take a look at the 5 data types of redis

coldplay.xixi
coldplay.xixiforward
2021-03-04 10:33:362804browse

Take a look at the 5 data types of redis

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
Take a look at 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
Take a look at 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
srem: Delete an element in a set data
Take a look at 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
Take a look at 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
Take a look at the 5 data types of redis

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!

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