[Redis] set data structure

A description

One type redis set (collection)


Two, redis its internal implementation

1: hashmap (hash table) to achieve the hash table, key = value, value = null can, hash links

2: intset- can be understood as an ordered array of positive numbers


Third, the data structure definition intset


contents: byte array, which may have 16bit, 32bit, 64bit encoded into an integer manner

encoding:INTSET_ENC_INT16,INTSET_ENC_INT32,INTSET_ENC_INT64


Four, redis use

1.contents stored as an array of integers, and which ensures the orderly

2. Because the contents ordered, and by the encoding contents encoding format unification, so take a binary search query


5, configuration parameters control

set-max-intset-entries, indicating a maximum integer not more than this value, using the stored IntSet type, in order to save memory consumption




Published 140 original articles · won praise 28 · views 180 000 +

Guess you like

Origin blog.csdn.net/qq_16097611/article/details/79921266