Common Redis commands and redis commands

Source: Internet
Author: User

Common Redis commands and redis commands

1 Create-store or not-View-delete

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

2. serialization record

Set name maojun; exists name; dump name; the client is logged out, and exists name and name still exist.

3. Set the survival time for the key-Modify the survival time

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

4 insert several records-view all keys

Mset one 1 twon 2 three 3; key *;

5. Move the record from db0 to db1

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

6. time when the key is removed

Set name maojun; ttl name; expire name 3000; ttl name; persist name; ttl name

7. Return a random key.

Randomkey

7. Change the key name

Set name maojun; get name; rename name self-name; get self-name; exists name;

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

Set name maojun; get name; dump 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 values

Lpush step 1 2 3 4 1; sort step desc; lpush website www.so.com www.baidu.com www.google.com; sort website alpha desc limit 0 1;

10 view type

Set name maojun; get name; type name;

11 value appending

Set name maojun; append name "wang ";

12 create-query-delete 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;

13 adjust the value of the HashTable integer

Hincrby counter pv 200; hget counter pv; hincrby counter pv 300; hincrby counter pv-100; hget counter pv;

14 adjust the value of HashTable Float Type

Hincrby mykey f1 20.1; hincrby mykey f1 0.3; hget mykey f1;

16 HashTable create-key view-view the number of records-retrieve multiple records at a time-retrieve all values

Hmset website google www.google.com so www.so.com baidu www.baidu.com; hkeys website; hlen website; hmet website google so
1) "www.google.com"; hvals website



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.