INCRBYFLOAT

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Increment by a given number (integer/float)

Increments by the specified number.
If the key does not exist, 0 is used as the base and the specified number is returned.

Example

Command>incrbyfloat key 15.6
Result>15.6
Command>incrbyfloat key 3.3
Result>18.9
In AOF it is rewritten and recorded as a SET command. From version 6.0, the KEEPTTL option was added to SET to preserve expire time. SET key 18.9 KEEPTTL


Negative numbers are allowed

You can also specify a negative number.

Example

Command>incrbyfloat key -25.5
Result>-25.5


Syntax

INCRBYFLOAT key increment

  • Available since version 2.6.0.
  • Time complexity is O(1).
Related commands INCR, DECR, INCRBY, DECRBY
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< DECRBY INCRBYFLOAT SETNX >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.