当前位置:网站首页>Redis command string
Redis command string
2022-06-25 18:14:00 【[email protected]】
List of articles
1. set
set key value Set the corresponding value for a string key 
Twice use set, hinder set The set value will overwrite the previously set value
With options set:
- NX:SET The command will only perform the setting operation when the key has no value

- XX: SET The command only performs the setting operation when the key already has a value

2. get
get key Get the value of the specified string key from the database 
3. getset
getset key new_value: First, get the current value of the string key , Then set a new value for the key , Finally, the old value obtained before is returned to the user 
4. mset
mset key1 value1 key2 value2...:MSET The command can set values for multiple string keys at once 
Continuous multiple use mset, The new value overwrites the old value
5. mget
mget kay1 key2...:MGET Accept one or more string keys as arguments , And return the values of these string keys 
If mget To a nonexistent key, return nil
6. msetnx
msetxx key1 value1 key2 value2...: MSETNX The key is set only when none of the given keys exist 

7. strlen
strlen(key): Get the byte length of the value stored in the string key 

8. String index

8.1 getrange
getrange key start end: Get string key[start,end] Left closed right closed interval 
8.2 setrange
set key index new_content: Remove the value of the string key from the index index Replace the beginning with the specified new content 
When the new content given by the user is longer than the replaced content ,SETRANGE The command will automatically expand the modified string value , To ensure that new content can be written smoothly 
9. append
append key suffix Appends the given content to the end of the existing value of the string key 

10. incrby/decrby
incrby key1 increment Integer value plus the specified Integer increment 
decrby key1 increment Integer value minus the specified Integer increment

10.1 Type restrictions

- key Cannot be of string type ,incrment Empathy
- key It can't be a floating-point number ,incrment Empathy
- key Can't be more than 64 An integer ,incrment Empathy
10.2 Handle nonexistent keys

11. incr/decr
incr key Integer value plus 1decr key Integer value minus 1
12. incrbyfloat
incrbyfloat key increment: Add a floating-point increment to the numeric value stored in the string key , And return the numeric value of the key after performing the addition operation as the return of the command 
If you want to subtract, you will increment Set to negative
Be careful :
- INCRBYFLOAT The command can be used for both floating-point values , It can also be used for integer values
- INCRBYFLOAT The increment of the command can be either a floating point number , It can also be an integer
- When INCRBYFLOAT When the execution result of the command can be expressed as an integer , The execution result of the command will be stored as an integer
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202190532337480.html
边栏推荐
- 沁恒CH583 USB 自定义HID调试记录
- jvm问题复盘
- Redis trend - NVM memory
- Is the actual account opening complicated? Is online account opening safe?
- 广发易淘金和指南针哪个更好,更安全一些
- Interrupt operation: abortcontroller learning notes
- 【 NLP 】 in this year's English college entrance examination, CMU delivered 134 high scores with reconstruction pre training, significantly surpassing gpt3
- CentOS7 安装 Redis 7.0.2
- What is an operator?
- 存在重复元素III[利用排序后的有序性进行剪枝]
猜你喜欢

观察者模式之通用消息发布与订阅

lock

喜报|海泰方圆通过CMMI-3资质认证,研发能力获国际认可

近来开发的一款简单易用的图可视化工具

Chapter 4:win10 installing mingw64

Deep understanding of ELF files

Optimization of lazyagg query rewriting in parsing data warehouse

158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts

深入理解ELF文件

微博评论的计算架构
随机推荐
[tips] how to quickly start a new position for a new software testing engineer
Fixed frequency and voltage regulation scheme of Qi v1.2.4 protocol
Qi v1.2.4协议 之 定频调压方案
ACY100油烟浓度在线监控仪针对饮食业厨房油烟排放
Bilstm and CRF
什么是算子?
SDN系统方法 | 10. SDN的未来
SDN system method | 9 Access network
深入理解ELF文件
lock
SDN系统方法 | 9. 接入网
Essential characteristics of convolution operation +textcnn text classification
Qt使用SQLITE数据库
Article 7: there is no code prompt in clion,,,
存在重复元素III[利用排序后的有序性进行剪枝]
Hover effect of eight buttons
Qinheng ch583 USB custom hid debugging record
Three traversal methods of binary tree (recursive + non recursive) complete code
深度学习网路模型
Recursion and divide and conquer