当前位置:网站首页>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
边栏推荐
- 怎么判断自己是否适合转行软件测试
- 篇5:VS2017搭建QT5.9.9开发环境
- Matlab中图形对象属性gca使用
- 篇4:win10安装MingW64
- How to open a stock account? Is it safe to open a securities account
- SDN系统方法 | 10. SDN的未来
- 158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
- What is an operator?
- Chapter 4:win10 installing mingw64
- 【 NLP 】 in this year's English college entrance examination, CMU delivered 134 high scores with reconstruction pre training, significantly surpassing gpt3
猜你喜欢
Encryption trend: Fashion advances to the meta universe
Solve nvprof error err_ NVGPUCTRPERM - The user does not have permission to profile on the target device.
SQL Server real time backup library requirements
Uncover ges super large scale graph computing engine hyg: Graph Segmentation
158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts
Sword finger offer double pointer
lock
Kotlin of Android cultivation manual - several ways to write a custom view
What is an operator?
.NET Worker Service 如何优雅退出
随机推荐
The Stackies 2022:32个营销技术栈入选
[daily record] - bug encountered during BigDecimal Division
Chapter 4:win10 installing mingw64
SDN系统方法 | 10. SDN的未来
力扣每日一题-第27天-561.数组拆分Ⅰ
Introduction to microservices
股票开户怎么办理 办理开户安全吗
OSError: Unable to open file (truncated file: eof = 254803968, sblock->base_addr = 0, stored_eof = 2
ACY100油烟浓度在线监控仪针对饮食业厨房油烟排放
158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
Qt使用SQLITE数据库
Unity technical manual - size over lifetime and size by speed
Deeply understand and grasp the basic characteristics of digital economy
About Equilibrium - Simplified bottleneck model
Redis趋势—NVM内存
IVX 启航
广发易淘金和指南针哪个更好,更安全一些
The stacks 2022:32 marketing technology stacks selected
.NET Worker Service 添加 Serilog 日志记录
踩坑记录---线程池拒绝策略引起的一系列巧合