diff options
author | Viktor Söderqvist <viktor.soderqvist@est.tech> | 2022-11-09 18:50:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 19:50:07 +0200 |
commit | 4e472a1a7fc0dc2c7da2b48ac7342e9385b4f92a (patch) | |
tree | 62715e6a8fb51264449aa6ef0866f92d9d1e00bf /src/intset.h | |
parent | 07d187066a86a9a3124af740373bf5bf49e345ff (diff) | |
download | redis-4e472a1a7fc0dc2c7da2b48ac7342e9385b4f92a.tar.gz |
Listpack encoding for sets (#11290)
Small sets with not only integer elements are listpack encoded, by default
up to 128 elements, max 64 bytes per element, new config `set-max-listpack-entries`
and `set-max-listpack-value`. This saves memory for small sets compared to using a hashtable.
Sets with only integers, even very small sets, are still intset encoded (up to 1G
limit, etc.). Larger sets are hashtable encoded.
This PR increments the RDB version, and has an effect on OBJECT ENCODING
Possible conversions when elements are added:
intset -> listpack
listpack -> hashtable
intset -> hashtable
Note: No conversion happens when elements are deleted. If all elements are
deleted and then added again, the set is deleted and recreated, thus implicitly
converted to a smaller encoding.
Diffstat (limited to 'src/intset.h')
-rw-r--r-- | src/intset.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/intset.h b/src/intset.h index 772f847b6..41cc7b822 100644 --- a/src/intset.h +++ b/src/intset.h @@ -43,6 +43,8 @@ intset *intsetAdd(intset *is, int64_t value, uint8_t *success); intset *intsetRemove(intset *is, int64_t value, int *success); uint8_t intsetFind(intset *is, int64_t value); int64_t intsetRandom(intset *is); +int64_t intsetMax(intset *is); +int64_t intsetMin(intset *is); uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value); uint32_t intsetLen(const intset *is); size_t intsetBlobLen(intset *is); |