Redis ZRANDMEMBER Command Explained

In Redis, the ZRANDMEMBER command enables us to get one or more random elements from a sorted set.

We can specify whether or not to return only distinct elements or to allow duplicates. We can also specify whether or not to include the scores of each element in the result.

Read more

Redis ZRANGE Command Explained

In Redis, the ZRANGE command returns the specified range of elements in the sorted set stored at the specified key.

It can perform different types of range queries: by index (rank), by the score, or by lexicographical order.

Read more

Redis ZADD Command Explained

In Redis, the ZADD command is used to add one or more members to a sorted set, or to update the score for members that already exist in the sorted set.

It returns the number of elements added to the sorted set, or the number of elements updated if the CH argument is used.

Read more

PostgreSQL DATE_BIN() Function Explained

In PostgreSQL, the DATE_BIN() function enables us to “bin” a timestamp into a given interval aligned with a specific origin. In other words, we can use this function to map (or force) a timestamp to the nearest specified interval.

This can be handy when we want to truncate a timestamp to a given interval, for example a 10 minute interval. We can specify the interval (e.g. 10 minutes, 15 minutes, 30 minutes, etc), and we can specify the starting point for the interval. Therefore, we can have the interval starting at any odd time we want (it doesn’t need to start on the hour or anything like that).

Read more

Redis HINCRBYFLOAT Command

The Redis HINCRBYFLOAT command increments the field in the hash at the specified key by a floating point number. We specify how much we want the field to increment by when we call the command.

Read more

Redis HINCRBY Command

The Redis HINCRBY command increments the number that’s stored at the specified field in the hash at the specified key. We specify how much we want the field to increment by when we call the command.

Read more