Redis key (key) tutorial-Redis Tutorials

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.