Redis Basic Learning (iii)-KEY operations

Source: Internet
Author: User

First, the relevant operation of key

1. Delete

Del key1 Key2 ... Keyn

Function: Delete 1 or more keys.

Return value: The nonexistent key is ignored, returning the number of really deleted keys.

2. Renaming

Rename Key Newkey

Function: Assign a new key to key name note: If Newkey already exists, then the Newkey's original value is overwritten.

3. Random key

Function: Returns the Random key.

4. Is there a key

Exists key

Function: Determines whether the key exists, returns 1/0.

5. Determine the type of key

Type key

Function: Returns the type of the value stored by key with String,link,set,order set, hash.

6. Query the valid time of key

TTL key

Function: Query Key's lifetime return: number of seconds.

7. Set the validity period of key

Expire key seconds

Function: Sets the life cycle of the key, in seconds.

Persist key

Function: Specifies that the key is permanently valid.

Redis Basic Learning (iii)-key actions

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.