Redis SUBSTR Equivalent

Many SQL databases have a SUBSTR() or equivalent function that returns a substring from a specified string.

Redis has a SUBSTR command, but it was deprecated in Redis 2.0.0.

However, Redis also has the GETRANGE command, that basically does the same thing. Basically, anything that was possible with the Redis SUBSTR command, is now possible with the GETRANGE command.

And the GETRANGE command does basically the same thing that most of the SUBSTR() and SUBSTRING() functions do in the SQL world – gets a substring from a string.

Continue reading

Redis DECRBY Command Explained

In Redis, the DECRBY command decrements the value of a key by the specified amount.

If the key doesn’t exist, DECRBY creates the key with a value of 0 and then decrements it by the specified amount.

An error occurs if the key contains a value of the wrong type or contains a string that cannot be represented as integer. DECRBY operations are limited to 64 bit signed integers.

Continue reading

Redis INCRBYFLOAT Command Explained

In Redis, the INCRBYFLOAT command increments a floating point number by the specified amount. More specifically, it increments the string representing a floating point number stored at the specified key.

If the key doesn’t exist, INCRBYFLOAT creates the key with a value of 0 and then increments it by the specified amount.

An error occurs if the key contains a value of the wrong type, or if the current key content or the specified increment are not parsable as a double precision floating point number.

Continue reading

Redis INCRBY Command Explained

In Redis, the INCRBY command increments the value of a key by the specified amount.

If the key doesn’t exist, INCRBY creates the key with a value of 0 and then increments it by the specified amount.

An error occurs if the key contains a value of the wrong type or contains a string that cannot be represented as integer. INCRBY operations are limited to 64 bit signed integers.

Continue reading