📅  最后修改于: 2020-12-02 01:02:49             🧑  作者: Mango
Redis密钥与Redis命令一起使用来进行自我管理。请参阅在命令中使用Redis键的语法。
句法:
redis 127.0.0.1:6379> COMMAND KEY_NAME
例
让我们以与Redis DEL命令一起使用的Redis密钥为例。如果删除键,它将给出输出1,否则将为0。
redis 127.0.0.1:6379> SET javatpoint redis
OK
redis 127.0.0.1:6379> DEL javatpoint
(integer) 1
此处,“ DEL”是Redis命令,而“ javatpoint”是键。
Index | Command | Description |
---|---|---|
1 | DEL key | This command is used to delete the key, if it exists. |
2 | DUMP key | This command is used to return a serialized version of the value stored at the specified key. |
3 | EXISTS key | This command is used to check whether the key exists or not. |
4 | EXPIRE key | This command is used to set the expiry of the key after the specified time in seconds. |
5 | EXPIREAT key | This command is used to set the expiry of the key after the specified time. Here time is in UNIX timestamp format. |
6 | PEXPIRE key | This command is used to set the expiry of key in milliseconds. |
7 | PEXPIREAT key | This command is used to set the expiry of the key in UNIX timestamp specified as milliseconds. |
8 | KEYS pattern | This command is used to find all keys matching the specified pattern. |
9 | MOVE key | It is used to move a key to another database. |
10 | PERSIST key | It is used to remove the expiration from the key. |
11 | PTTL key | It is used to retrieve the remaining time in keys expiry in milliseconds. |
12 | TTL key | It is used to retrieve the remaining time in keys expiry. |
13 | randomkey | It is used to get a random key from Redis. |
14 | RENAME key newkey | It is used to change the key name. |
15 | RENAMENX key newkey | It is used to rename the key, if a new key doesn’t exist. |
16 | TYPE key | It is used to fetch the data type of the value stored in the key. |