当前位置:网站首页>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
边栏推荐
- Encryption trend: Fashion advances to the meta universe
- SQL Server real time backup library requirements
- Slam visuel Leçon 14 leçon 9 filtre Kalman
- Is it convenient to open a stock account? Is online account opening safe?
- Qt产生指定范围内随机数(随机字符串)
- Fixed frequency and voltage regulation scheme of Qi v1.2.4 protocol
- 什么是泛型以及在集合中泛型的使用[通俗易懂]
- Solve nvprof error err_ NVGPUCTRPERM - The user does not have permission to profile on the target device.
- Bert's summary of me
- Idea global search for Chinese characters [easy to understand]
猜你喜欢

Using QT to make a beautiful login interface box

Handling method of qstring containing "\u0000" in QT

New characteristics of cultural consumption in the era of digital economy

SQL Server real time backup library requirements

解决nvprof 报错ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device.

深入理解ELF文件

.NET Worker Service 添加 Serilog 日志记录

ASP.NET超市便利店在线购物商城源码,针对周边配送系统

Good news | Haitai Fangyuan has passed the cmmi-3 qualification certification, and its R & D capability has been internationally recognized

Deeply understand and grasp the basic characteristics of digital economy
随机推荐
使用DiskGenius拓展系统盘C盘的容量
Utilisation de diskgenius pour augmenter la capacité du disque système C
Redis trend - NVM memory
图标丢失,URL附带JESSSIONID的什么来的?
Use diskgenius to expand the capacity of system disk C
[daily record] - bug encountered during BigDecimal Division
Deeply understand and grasp the basic characteristics of digital economy
实际开户复杂吗?在线开户安全么?
Garbage collector and memory allocation strategy
158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
Distributed remote management of distribution room environment
What is public chain development? What are the public chain development projects?
Py3.6 and py3.7 installed by CONDA
SDN system method | 10 The future of SDN
Solve nvprof error err_ NVGPUCTRPERM - The user does not have permission to profile on the target device.
Optimization of lazyagg query rewriting in parsing data warehouse
QT using SQLite database
IVX sailing
C语言中%含义
lock