Redis – String Incrbyfloat Command

  • Post author:
  • Post category:Redis
  • Post comments:1 Comment

Redis INCRBYFLOAT command is used to increment the string representing a floating point number, stored at the key by the specified increment. If the key does not exist, it is set to 0 before performing the operation. If the key contains a value of the wrong type or the current key content or the specified increment are not parsable as floating point number, then an error is returned.

Return Value

String reply, the value of the key after the increment.

Syntax

Following is the basic syntax of Redis INCRBYFLOAT command.

redis 127.0.0.1:6379> INCRBYFLOAT KEY_NAME INCR_AMOUNT 

Example

redis 127.0.0.1:6379> SET visitors 1000.20 
OK 
redis 127.0.0.1:6379> INCRBYFLOAT visitors .50 
1000.70 
redis 127.0.0.1:6379> GET visitors 
1000.70

This Post Has One Comment

Leave a Reply