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