incr
abbr.increase (value, price, inventory, amount, production, etc.) increase;increasing increase;increased increase;incremental increase
by
英[ba?] 美[ba?]
prep.beside...;expression method;due to;passing through
adv.passing;expressing reservation Or use when saving; short visit
float
英[fl??t] 美[flo?t]
vt.& vi. (make) float; (make) float; float freely
vi. wander
vt. put forward, draw for consideration; (stock) go public
n. float; floating object; floating board; A drink with ice cream floating on it
Third person singular: floats Plural: floats Present participle: floating Past tense: floated Past participle: floated
redis INCRBYFLOAT command syntax
Function: Adds floating point increment to the value stored in key.
Syntax: INCRBYFLOAT key increment
Description: If key does not exist, then INCRBYFLOAT will first set the value of key to 0 before executing Addition operation. If the command is executed successfully, the value of key will be updated to the new value (after the addition), and the new value will be returned to the caller in the form of a string. Whether it is the value of key or the increment, it can be represented by exponential notation like 2.0e7, 3e5, 90e-2. However, the value after executing the INCRBYFLOAT command is always stored in the same form. That is, they always consist of a number, an (optional) decimal point, and a decimal part of any digit (such as 3.14, 69.768, etc.), with trailing 0's removed if necessary. Floating point numbers will also be changed to integers (for example, 3.0 will be saved as 3 ). In addition, no matter how long the actual precision of the floating point number obtained by the addition is, the calculation result of INCRBYFLOAT can only represent up to seventeen decimal places.
Available versions: >= 2.6.0
Time complexity: O(1)
Return: The value of key after executing the command.
redis INCRBYFLOAT command example
# 值和增量都不是指數(shù)符號(hào) redis> SET mykey 10.50 OK redis> INCRBYFLOAT mykey 0.1 "10.6" # 值和增量都是指數(shù)符號(hào) redis> SET mykey 314e-2 OK redis> GET mykey # 用 SET 設(shè)置的值可以是指數(shù)符號(hào) "314e-2" redis> INCRBYFLOAT mykey 0 # 但執(zhí)行 INCRBYFLOAT 之后格式會(huì)被改成非指數(shù)符號(hào) "3.14" # 可以對(duì)整數(shù)類型執(zhí)行 redis> SET mykey 3 OK redis> INCRBYFLOAT mykey 1.1 "4.1" # 后跟的 0 會(huì)被移除 redis> SET mykey 3.0 OK redis> GET mykey # SET 設(shè)置的值小數(shù)部分可以是 0 "3.0" redis> INCRBYFLOAT mykey 1.000000000000000000000 # 但 INCRBYFLOAT 會(huì)將無用的 0 忽略掉,有需要的話,將浮點(diǎn)變?yōu)檎麛?shù) "4" redis> GET mykey "4"