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

A brief discussion on the 5 data types of redis

青灯夜游
Release: 2021-07-12 09:52:22
forward
9464 people have browsed it

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template