edis 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 Adglob redis OK redis 127.0.0.1:6379> DEL Adglob (integer) 1
In the above example, DEL is the command, while Adglob 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 | DEL keyThis https://adglob.in/blog/redis-keys-del-command/ command deletes the key, if it exists. |
2 | DUMP keyThishttps://adglob.in/blog/redis-keys-dump-command/ command returns a serialized version of the value stored at the specified key. |
3 | EXISTS keyThis https://adglob.in/blog/redis-keys-exists-command/ command checks whether the key exists or not. |
4 | EXPIRE key https://adglob.in/blog/redis-keys-expire-command/ secondsSets the expiry of the key after the specified time. |
5 | EXPIREAT key https://adglob.in/blog/redis-keys-expireat-command/ timestampSets the expiry of the key after the specified time. Here time is in Unix timestamp format. |
6 | PEXPIRE key https://adglob.in/blog/redis-keys-pexpire-command/ millisecondsSet the expiry of key in milliseconds. |
7 | PEXPIREAT key https://adglob.in/blog/redis-keys-pexpireat-command/ milliseconds-timestampSets the expiry of the key in Unix timestamp specified as milliseconds. |
8 | KEYS patternFindshttps://adglob.in/blog/redis-keys-command/ all keys matching the specified pattern. |
9 | MOVE key https://adglob.in/blog/redis-keys-move-command/ dbMoves a key to another database. |
10 | PERSIST https://adglob.in/blog/redis-keys-persist-command/ keyRemoves the expiration from the key. |
11 | PTTL keyGets https://adglob.in/blog/redis-keys-pttl-command/ the remaining time in keys expiry in milliseconds. |
12 | TTL keyGets https://adglob.in/blog/redis-keys-ttl-command/ the remaining time in keys expiry. |
13 | RANDOMKEYReturns https://adglob.in/blog/redis-keys-random-key-command/ a random key from Redis. |
14 | RENAME key https://adglob.in/blog/redis-keys-rename-command/ newkeyChangesthe key name. |
15 | RENAMENX key newkeyRenameshttps://adglob.in/blog/redis-keys-renamenx-command/ the key, if a new key doesn’t exist. |
16 | TYPE keyReturns https://adglob.in/blog/redis-keys-type-command/ the data type of the value stored in the key. |
Pingback: target turkey tail mushroom capsules