Redis – Hash Hincrbyfloat Command

  • Post author:
  • Post category:Redis
  • Post comments:2 Comments

Redis HINCRBYFLOAT command is used to increment the specified field of a hash stored at the key, and representing a floating point number, by the specified increment. If the field does not exist, it is set to 0 before performing the operation. If the field contains a value of wrong type or specified increment is not parsable as floating point number, then an error occurs.

Return Value

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

Syntax

Following is the basic syntax of Redis HINCRBYFLOAT command.

redis 127.0.0.1:6379> HINCRBYFLOAT KEY_NAME FIELD_NAME INCR_BY_NUMBER 

Example

redis 127.0.0.1:6379> HSET myhash field 20.50 
(integer) 1 
redis 127.0.0.1:6379> HINCRBYFLOAT mykey field 0.1 
"20.60" 

This Post Has 2 Comments

Leave a Reply