Redis BLPOP Command Explained

In Redis, the BLPOP command is the blocking version of the LPOP command. It blocks the connection when there are no elements to pop from any of the given lists.

The way the command works is that an element is popped from the head of the first list that is non-empty, with the given keys being checked in the order that they are given. When there are no elements to pop from any of the lists, it blocks the connection.

Continue reading

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