Khóa học miễn phí Redis – Keys nhận dự án làm có lương

Redis – Keys



Redis keys commands are used for managing keys in Redis. Following is the syntax for using redis keys commands.

Syntax

redis 127.0.0.1:6379> COMMAND KEY_NAME

Example

redis 127.0.0.1:6379> SET tutorialspoint redis 
OK 
redis 127.0.0.1:6379> DEL tutorialspoint 
(integer) 1

In the above example, DEL is the command, while tutorialspoint is the key. If the key is deleted, then the output of the command will be (integer) 1, otherwise it will be (integer) 0.

Redis Keys Commands

Following table lists some basic commands related to keys.

Sr.No Command & Description
1

This command deletes the key, if it exists.

2

This command returns a serialized version of the value stored at the specified key.

3

This command checks whether the key exists or not.

4 seconds

Sets the expiry of the key after the specified time.

5

Sets the expiry of the key after the specified time. Here time is in Unix timestamp format.

6

Set the expiry of key in milliseconds.

7

Sets the expiry of the key in Unix timestamp specified as milliseconds.

8

Finds all keys matching the specified pattern.

9

Moves a key to another database.

10

Removes the expiration from the key.

11

Gets the remaining time in keys expiry in milliseconds.

12

Gets the remaining time in keys expiry.

13

Returns a random key from Redis.

14

Changes the key name.

15

Renames the key, if a new key doesn”t exist.

16

Returns the data type of the value stored in the key.

Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc