Home >Database >Redis >A brief discussion on the 5 data types of redis

A brief discussion on the 5 data types of redis

青灯夜游
青灯夜游forward
2021-04-28 18:46:459419browse

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.

A brief discussion on the 5 data types of redis

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

A brief discussion on 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 certain list data type

A brief discussion on 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

A brief discussion on the 5 data types of redis
5. Commonly used hash data types supported Command:

hset: Add hash data

hget: Get hash data

hmget: Get multiple hash data

A brief discussion on 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

A brief discussion on the 5 data types of redis

#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!

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