YouTip LogoYouTip

Redis Keys

# Redis Keys Redis key commands are used to manage Redis keys. ### Syntax The basic syntax for Redis key commands is as follows: redis 127.0.0.1:6379> COMMAND KEY_NAME ### Example redis 127.0.0.1:6379> SET tutorialkey redis OK redis 127.0.0.1:6379> DEL tutorialkey (integer) 1 In the above example, **DEL** is a command, and **tutorialkey** is a key. If the key is successfully deleted, the command will output **(integer) 1**, otherwise it will output **(integer) 0**. * * * ## Redis Keys Commands The following table lists the basic commands related to Redis keys: | No. | Command and Description | | --- | --- | | 1 | (#) This command is used to delete a key when it exists. | | 2 | (#) Serializes the given key and returns the serialized value. | | 3 | (#) Checks if the given key exists. | | 4 | (#) seconds Sets the expiration time of a given key in seconds. | | 5 | (#) EXPIREAT works similarly to EXPIRE, both are used to set the expiration time of a key. The difference is that the EXPIREAT command accepts a UNIX timestamp as the time parameter. | | 6 | (#) Sets the expiration time of a key in milliseconds. | | 7 | (#) Sets the expiration time of a key as a UNIX timestamp in milliseconds. | | 8 | (#) Finds all keys matching the given pattern. | | 9 | (#) Moves the current database's key to the given database db. | | 10 | (#) Removes the expiration time of a key, making it persist. | | 11 | (#) Returns the remaining time to live of a key in milliseconds. | | 12 | (#) Returns the remaining time to live (TTL) of a given key in seconds. | | 13 | (#) Returns a random key from the current database. | | 14 | (#) Renames a key. | | 15 | (#) Renames a key to a new key only if the new key does not exist. | | 16 | [SCAN cursor ](#) Iterates over the keys in the database. | | 17 | (#) Returns the type of value stored at the key. | For more commands, please refer to: [https://redis.io/commands](https://redis.io/commands)
← Prop Style BorderimageoutsetAppml Download β†’