Redis Common Commands

Source: Internet
Author: User

1 Create-Save-view-delete

Set name maojun;exists name;get Name;del name;

2 serialization of records

Set name maojun;exists name;dump name; Exit client is entered, exists Name,name still exists.

3 Setting the time to live-modify the time to live

Set name maojun;exists name;expire name 30;expire name 3000;ttl name;

4 inserting a few records-view all keys

Mset One 1 Twon 2 three 3;key *;

5 Records moved from Db0 to DB1.

Select 0;set name maojun;get name;move name 1;select 1;get name;

6 removal of key expiration time

Set name Maojun;ttl name;expire name 3000;ttl name;persist name;ttl Name

7 Randomly returns a key

Randomkey

7 changing the name of key

Set name Maojun;get name;rename name Self-name;get self-name;exists name;

8 deserialization (assigns a value to the new key based on the value on the disk)

Set name Maojun;get name;d UMP Name;exit;. /redis-cli-h 192.168.121.128-p 6379;get name;dump name;restore name-another 0 "\x00\x06maojun\x06\x00 \x1dyY\xd9&\ X94\xf6 "; Exit;keys *

9 Sort By value

Lpush Step 1 2 3 4 1;sort step;sort step Desc;lpush website www.so.com www.baidu.com Www.google.com;sort website alpha;sor T website Alpha Desc;sort website Alpha desc limit 0 1;

10 Viewing types

Set name Maojun;get name;type name;

One value append

Set name Maojun;append name "Wang";

Create-query-delete of Hashtable

Hset abbr a apple;hset abbr b banana;hset abbr c cat;hset abbr d dog;hget all abbr;hget abbr A;hdel abbr a b c D;

Hashtable shaping value Value size adjustment

Hincrby Counter PV 200;hget counter Pv;hincrby counter PV 300;hincrby counter Pv-100;hget counter PV;

HashTable float type numeric size adjustment

Hincrby MyKey F1 20.1;hincrby mykey F1 0.3;hget MyKey F1;

HashTable Create-key View-view number of records-take multiple records at once-remove all value

Hmset website Google www.google.com so www.so.com Baidu Www.baidu.com;hkeys website; Hlen Website;hmget website Google so
1) "www.google.com"; Hvals website



Redis 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.