Redis data type: SET type; redis data type: set

Source: Internet
Author: User

Redis data type: SET type; redis data type: set

Web programmer blog: http://blog.csdn.net/thinkercode

Set Type-Features

Set is a set. It is similar to the set concept in our mathematics. It adds and deletes elements to a set, and performs operations such as intersection and other operations on multiple sets, the key in the operation is interpreted as the name of the set.
Redis's set is a unordered set of the string type. The set element can contain up to 32 Elements of 2.
Set is implemented through hash table, so the complexity of adding, deleting, and searching is O (1 ). The hash table is automatically adjusted with the addition or deletion. Note that synchronization (getting write locks) is required to adjust the hash table size, which will block other read/write operations and may be implemented using the skip table (skip list) soon, the table has been used in sortedset. In addition to basic addition and deletion operations, other useful operations include union, intersection, and difference ). Through these operations, you can easily implement the friend recommendation and blog tag FUNCTIONS In sns.

Set Type-Application Scenario

The functions provided by set are similar to those provided by list. When you need to store a list of data without repeated data, set is a good choice, in addition, set provides an interface to determine whether a member is in a set. This is not provided by list. You can use the Redis set structure to implement friend recommendation and blog tag FUNCTIONS In SNS.

Set Type-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.