Common redis commands

Source: Internet
Author: User
Tags redis server

Key
View all the keys in the database
Keys * // view all
Keys my * // view

Exists
Check whether a key exists. If yes, 1 is returned. If no key exists, 0 is returned.
For example:
Exists myname

Del
If a key is deleted, 1 is returned.
For example:
Del mylist

Expire
Set the expiration time of a key
For example:
Expire mylist 10 // set mylist to expire after 10 seconds

Move
Move the keys in the current database to redis. By default, there are 0-15 databases and 0 databases by default. Select numbers can be used to access other databases.

Persist
Remove the expiration time of a given key
For example:
Persist age

Randomkey
Returns a random key in the database.
For example:
Randomkey

Rename
Rename key
For example:
Rename age age_now

Type
Returns the type of the specified key.
For example:
Type mylist3



Server commands:
Ping
Test whether the connection is alive

Echo
The output is the same as that of PHP.

Select
Select a database. The redis database number ranges from 0 to 15. You can select any database for read operations.

Quit
Exit

Dbsize
Returns the number of keys in the current database.

Info
Obtain information about the redis Server

Config get
Requests received by real-time storage Transfer

Flushdb
Clear all keys in the current database

Flushall
Delete keys in all databases

Common redis commands

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.