Introduction to a collection of objects
Like a list, multiple strings can be stored, but the collection uses a hash table to ensure that the elements stored by itself cannot be repeated . The elements in the collection are arranged out of order
Two commonly used commands
Common commands
At the same time, Redis provides convenient operations such as intersection (SINTER), union (SUNION), and difference (SDIFF) for sets.
Three internal coding
All elements of the collection object are stored integer values, and the number of elements in a collection of objects stored in no more than 512 (can be modified) th, using IntSet encoding, or encoding rules employed hashtable:
IntSet encoded using integers as a set of objects underlying implementation, All elements contained in the collection object are stored in the integer collection; the
hashtable-encoded collection object uses a dictionary as the underlying implementation. Each key of the dictionary is a string object, and each string object contains a collection element, and the dictionary The value of is all set to NULL
Specifically, you can see the collection object