Kill lui lei Dog---php developing redis---3-redis common commands

Source: Internet
Author: User

Redis provides rich commands for manipulating databases and various database types that can be used on Linux endpoints.

1. Key-Value related commands

(1)keys

Returns all keys that satisfy a given parameter

With an expression *, the delegate takes out all keys

(2)exists

Confirm if a key exists

1 means present, 0 means no

(3)expire

Set the expiration time for a key

(4)move:

Transfers the key from the current database to a different database.

Select the syntax for the database:

number of the Select database

The syntax for moving:

Move key target database number

(5)persist

Remove the expiration time for a given key

(6)Randomkey

Randomly returns a key in the key space

(4)move:

Transfers the key from the current database to a different database.

Select the syntax for the database:

number of the Select database

The syntax for moving:

Move key target database number

(5)persist

Remove the expiration time for a given key

(6)Randomkey

Randomly returns a key in the key space

(7)Rename

Rename Key

Syntax : Rename the original key name after the modified key name

(8)type: Types of return values

2. Server-related commands

(1)Select

Select the database. Redis database number from 0-15, we can select any database for data access.

When selecting 16 o'clock, an error indicates that there is no database numbered 16.

(2)quit (exit)

Exit connection

(3)dbsize

Returns the number of keys in the current database

(4)info

Gets the information and statistics of the server.

(5)config get

Gets the configuration of the parameter.

In this example, we get the value of the dir parameter configuration, and if you want to get the configuration of all the parameters simply execute "config get *" To display all the values.

(6)flushdb

Remove all keys from the currently selected database and use them sparingly in the real world

(7)Flushall

Remove all keys from all databases in the real world, use them with caution.

Kill lui lei Dog---php developing redis---3-redis common commands

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.