Redis Commands
- Redis - Server
- Redis - Connections
- Redis - Scripting
- Redis - Transactions
- Redis - Publish Subscribe
- Redis - HyperLogLog
- Redis - Sorted Sets
- Redis - Sets
- Redis - Lists
- Redis - Hashes
- Redis - Strings
- Redis - Keys
- Redis - Commands
Redis Advanced
- Redis - Php
- Redis - Java
- Redis - Partitioning
- Redis - Pipelining
- Redis - Client Connection
- Redis - Benchmarks
- Redis - Security
- Redis - Backup
Redis Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
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 psts some basic commands related to keys.
Sr.No | Command & Description |
---|---|
1 | This command deletes the key, if it exists. |
2 | This command returns a seriapzed version of the value stored at the specified key. |
3 | This command checks whether the key exists or not. |
4 | Sets the expiry of the key after the specified time. |
seconds
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 milpseconds. |
7 | Sets the expiry of the key in Unix timestamp specified as milpseconds. |
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 milpseconds. |
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. |