Redis Learning (5)-Common commands

Source: Internet
Author: User

Redis Common Commands
Redis provides rich commands for manipulating databases and various database types, which can be used in LinuxTerminal use
1. Key-Value related commands
2. Server-related commands

key-Value related commands

keys Pattern Example: Keys *
returns all keys that satisfy a given pattern

exists
confirm if a key exists

del
Delete a key

expire
set the expiration time for a key
Example: Expire addr 10 (time ten s)
ttl addr (use TTL to get the effective duration of addr)
returns-1, expired

Move moves the key in the current database to another database
Select Database
Select 0 (where 0 represents the first database)
command: (move the age of database 0 to database 1)
Select 0
Move age 1
Select 1
Get Age

persist
Remove the expiration time for a given key
command:
expire Age
persist Age

Randomkey
randomly returns a key in the key space

Rename
Rename key
Rename Age age_new

type
type of return value

server-related commands

Ping
Test If the connection is alive

Select
Select database, redis database number 0~15, we can select any database to
access to the data

quit
Exit Connection

dbsize
returns the number of keys in the current database

Info
get information and statistics for the server

Config Get
real-time upload of received requests

Flushdb
Delete all keys in the currently selected database

Flushall
remove all keys from all databases

Redis Learning (5)-Common 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.