Note One Redis Foundation

Source: Internet
Author: User

Running Redis in the cmd command

Running Redis command: REDIS-CLI

Preliminary study on REIDS data structure There are five types of string (string), list, set (set), hash (hash), Zset (ordered collection)

A simple introduction to the various types of Redis and the most basic commands

1.string (String)

String type: Is it a stored value? The stored data can be either a string or a column of int type

Can be obtained by get; Set; Del to add a read delete to the string type;

2.list (list) is a collection like an array that can store duplicate data, but data types that do not require uniform storage can be of type string and int.

Rpush (pushes the value to the right end of the list), Lrange (gets all the values above the list), Lindex (gets a single element at a given position on the class table) Lpop (POPs a value from the left end of the list and returns the value that pops up)

3.set (collection) Redis collections and lists can store multiple strings the difference between them is that the list can store multiple identical strings, and the collection guarantees that each string that it stores itself is different by using a hash table (these hashes have only keys, but no value associated with the key)

Sadd (adds the given element to the collection), Smembers (returns all the elements contained in the collection), Sismember (checks that the given element master exists in the collection), and Srem (removes the element if the given element has a collection)

Hash (hash) similar to dictionary type

Hset (a given key-value pair is associated with a hash-tired face); Hget (gets the specified hash value); Hgetall (gets all the key-value pairs that the hash contains) Hdel (if the given key is present in the hash remove the key)

Zset (ordered set) is used to store key-value pairs as well as hash columns: The key of an ordered set is called a member, each member is different, and the value of an ordered set is called a score, the score must be a floating-point number, and an ordered set can access the element based on the member's access to the element.

Zadd (Adds a value to the collection) Zrange (gets the element within the range based on the position of the element) Zrangebyscore (Gets the element within the score range) Zrem (if the given member exists in an ordered set then remove the member)

Note One Redis Foundation

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.