The Redis key command is used to manage Redis keys.
Grammar
The basic syntax for the Redis Key command is as follows:
Redis 127.0.0.1:6379> COMMAND Key_name
Instance
Redis 127.0.0.1:6379> SET w3ckey redisokredis 127.0.0.1:6379> DEL w3ckey (integer) 1
In the above instance DEL is a command, W3ckey is a key. If the key is deleted successfully, the command executes after output (integer) 1, otherwise the output (integer) 0
Redis keys Command
The following table shows the basic commands related to the Redis key:
Serial Number |
Command and Description |
1 |
DEL Key This command is used to delete key in the presence of key. |
2 |
DUMP Key Serializes the given key and returns the serialized value. |
3 |
EXISTS Key Checks if a given key exists. |
4 |
EXPIRE Key seconds Sets the expiration time for a given key. |
5 |
Expireat key Timestamp The Expireat function is similar to EXPIRE and is used to set the expiration time for the key. The difference is that the time parameter accepted by the Expireat command is a UNIX timestamp (Unix timestamp). |
6 |
Pexpire key milliseconds Set the expiration time of key to hundreds of milliseconds. |
7 |
Pexpireat Key Milliseconds-timestamp Set the timestamp for key expiration Time (Unix timestamp) in milliseconds |
8 |
KEYS pattern Finds all keys that match the given pattern (pattern). |
9 |
MOVE Key db Moves the key of the current database into the given DB. |
10 |
PERSIST Key When the key expires, key will persist. |
11 |
Pttl Key Returns the remaining expiration time of key in milliseconds. |
12 |
TTL Key Returns the remaining lifetime (TTL, Time to live) for a given key, in seconds. |
13 |
Randomkey Returns a key randomly from the current database. |
14 |
RENAME Key Newkey Change the name of the key |
15 |
Renamenx Key Newkey Rename the key to Newkey only if the Newkey does not exist. |
16 |
TYPE Key Returns the type of value stored by key. |
For more commands please refer to: http://redis.readthedocs.org/en/latest/index.html
Original address: http://www.manongjc.com/redis/redis_keys.html
Redis key (key) tutorial-Redis Tutorials