当前位置:网站首页>Redis (IV) - string of common data types of redis
Redis (IV) - string of common data types of redis
2022-04-22 13:42:00 【Mainong Feige】
Hello! , I'm Manon Feige , Thank you for reading this article , Welcome to three links with one button .
1. Python Basic column , Basic knowledge in a net ,9.9 Yuan can't buy a loss , I can't buy it . Python From entry to mastery
️ 2. Python Crawler column , Systematically learn the knowledge points of reptiles .9.9 Yuan can't buy a loss , I can't buy it , Ongoing update .python Reptile beginner level
️ 3. Ceph actual combat , Everything from principle to actual combat . Ceph actual combat
️ 4. Java Introduction to high concurrency programming , Punch in to learn Java High concurrency . Java Introduction to high concurrency programming
5. Take a stroll around the community , Weekly benefits , There are surprises every week . Manon Feige community , Leap plan
The whole network has the same name 【 Manon Feige 】 Welcome to your attention , personal VX: wei158556
List of articles
brief introduction
String yes Redis One of the most basic data types , One key One by one value.
String Type is binary safe , signify Redis Of String Can contain any data , such as jpg Picture or serialized object
String The type is Redis Basic data types , One Redis Middle string value At most 512MB.
Common commands
- Set a key value pair , If Redis The same key exists in , The original value will be overwritten .
set <key> <value>
for example : set k1 v1
- Get the value of a key
get <key>
for example :get k1

- Delete specified key Value
del <key>
for example :del k1
- Insert if it doesn't exist (not exists),
If it exists, it won't insert , This is a Redis Basic commands for distributed locks
setnx <key> <value>
for example :127.0.0.1:6379> setnx username zhangsan
(integer) 1
- Will be given
<value>Append to the end of the original value
append <key> <value>
For example, the forward key k1 String is appended to 200.

<key>Get the length of the value
strlen <ken>

- Increasing
take key The number value stored in the 1, Can only operate on numbers , If it is empty , The new value added is 1.
incr <key>
incrby <key> <increment>
for example :127.0.0.1:6379> incr age
command incrby <key> <increment> in <increment> It's the step length .

- Decline
take key The number stored in minus 1, Can only operate on numbers , The key for the operation must exist , And cannot be empty
decr <key>
decrby <key> <decrement>

- Set one or more... At the same time key-value Yes
mset <key1> <value1> <key2> <value2> ....
- Get one or more at the same time value
gset <key1> <key2> <key3> ....
- Set one or more... At the same time key-value Yes , If and only if all given key It doesn't exist . The command is atomic .
msetnx <key1> <value1> <key2> <value2> ....

- Get the range of values , Be similar to Java Medium substring, Front bag , Back bag
getrange <key> < The starting position > < End position >
- use
<value>overwrite<key>String value stored , from< The starting position >Start ( Index from 0 Start )
setrange <key> < The starting position > <value>

- While setting the key value , Set expiration time , Unit second
setex <key> < Expiration time > <value>

18. Trade in new for old , Set the new value and get the old value
getset <key> <value>

data structure
Redis( 5、 ... and )-Redis Of String The data structure of a string is a simple dynamic string
Reference resources
《Redis Design and implementation 》
Redis Basic types and their data structures
Simple dynamic string SDS
版权声明
本文为[Mainong Feige]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221339148806.html
边栏推荐
- Model based RL overview
- Array and string offset access syntax with curly braces is deprecated
- Harbor V2. 5 Mise à jour, quelles fonctions ont été ajoutées?
- 在珠江期货办理开户安全吗?
- Harbor v2.5更新,都增加了哪些功能?
- MySQL DNS resolution and host cache
- Specify the parameter serialization component in the swagger interface document as newtonsoft Json
- Apache skywalking alarm Configuration Guide
- 微信小程序添加数据到数据库
- #yyds干货盘点# 解决剑指offer:机器人的运动范围
猜你喜欢

Trying to access array offset on value of type int

Redis(主从复制、哨兵模式、集群)概述及部署

About chartjs screen size adaptation

Sixtool multi-functional multi-in-one generation hanging assistant system source code

What are the types of blocking queues in the thread pool?

Chinese English Dictionary of Accounting & Financial sentiment

Reading target detection (2): fast r-cnn

Redis persistence

【Zeekr_Tech】ROS/ROS 2介绍

Walking in the clouds - but there are books
随机推荐
Rust实现斐波那契数
Harbor v2.5更新,都增加了哪些功能?
各省GTFP綠色全要素生產率面板數據(2004-2018年)
#yyds干货盘点# 解决剑指offer:机器人的运动范围
Partition - elegant violence
堆排序详解(C语言)
HDU 2544 Dijkstra (template)
Summary of maximum matching number, minimum path coverage number, maximum independent number and minimum point coverage number theorems
After talking about the difference between stack and queue, the interviewer threw up on the spot. Students should take warning.
美女同事的烦恼:如何配置 Apache SkyWalking 告警?
东吴证券X袋鼠云:数据轻松可取、毫秒级反应能力,东吴证券做对了什么?
mysql FUNCTION xxx. CHARINDEX does not exist
Fizz企业级微服务网关-服务编排,祭出终结BFF层的大杀器
Redis persistence
Rust implements Fibonacci number
[fluent special topic] 91 illustration of future (II) yyds dry goods inventory of dart single thread asynchronous processing
一篇文章快速搞懂 Apache SkyWalking 的 OAL
启牛学堂让下载蜻蜓点金开户,才能继续在学习?可以下载嘛?安全吗?
Walking in the clouds - above firewood, rice, oil and salt
What saved me 60% of my coding time? Use MBG