In Redis, the TYPE
command returns a key’s type. More specifically, it returns the string representation of the type of the value stored at a given key.
Category: NoSQL
Redis UNLINK Command Explained
In Redis, the UNLINK
command removes the specified keys. It’s similar to the DEL
command, except that it performs the memory reclaiming in a different thread, so it is not blocking. The DEL
command, on the other hand, doesn’t do this.
More specifically, the UNLINK
command unlinks the keys from the keyspace, and then removes it later asynchronously.
Redis RENAMENX Command Explained
In Redis, the RENAMENX
command renames a key, but only if the new key doesn’t already exist.
RENAMENX
is similar to the RENAME
command, except that it only renames the key if the new one doesn’t already exist. The RENAME
command on the other hand, will overwrite the new key if it already exists.
How to Run the Same Command Multiple Times in Redis
The Redis CLI allows us to easily run a command multiple times. All we need to do is prefix the command with the number of times we want it to run.
Continue readingRedis RENAME Command Explained
In Redis, the RENAME
command renames a key. It allows us to give a key a new name.
Redis COPY Command Explained
In Redis, the COPY
command copies the value from one key to another.
This command was introduced in Redis 6.2.0.
Continue readingRedis RESTORE Command Explained
In Redis, the RESTORE
command creates a key associated with a value that is obtained by deserialising the provided serialised value (obtained via the DUMP
command).
The serialisation format contains a 64-bit checksum, as well as the RDB version. The RESTORE
command checks the RDB version and data checksum. If they don’t match an error is returned.
Redis GETRANGE Command Explained
In Redis, the GETRANGE
command allows us to get part of a string at a given key, starting and ending at the specified offsets.
The GETRANGE
command replaced the SUBSTR
command, which basically does the same thing. The SUBSTR
command is now considered deprecated (as of Redis 2.0.0).
Redis SETRANGE Command Explained
In Redis, the SETRANGE
command allows us to overwrite part of a string at a given key, starting at a specified offset. It overwrites the old value from the specified offset, for the entire length of the new value.
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.