Redis INCRBYFLOAT – How to increment a floating point value in redis
1 month ago Lalit Bhagtani 0
In this tutorial, we will learn about how to increment the string representing a floating point value stored at a key in redis datastore. For this we will use a COMMAND – INCRBYFLOAT in redis-cli.
This command is used to increment the string representing a floating point number stored at the key by the specified value. If the key does not exist, it is first created and set to 0 before performing the increment operation. If the key exist but value stored at the key is of wrong datatype ( not string datatype ) or contains a string value that can not be represented as a double precision floating point number then error is returned. The syntax of redis INCRBYFLOAT command is as follows :-
redis host:post> INCRBYFLOAT <keyname> <increment>
- (string) reply, representing the value of the key after the increment operation.
That’s all for how to increment the string representing a floating point value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.