MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zsetConvertToZiplistIfNeeded

Function zsetConvertToZiplistIfNeeded

app/redis-6.2.6/src/t_zset.c:1247–1257  ·  view source on GitHub ↗

Convert the sorted set object into a ziplist if it is not already a ziplist * and if the number of elements and the maximum element size and total elements size * are within the expected ranges. */

Source from the content-addressed store, hash-verified

1245 * and if the number of elements and the maximum element size and total elements size
1246 * are within the expected ranges. */
1247void zsetConvertToZiplistIfNeeded(robj *zobj, size_t maxelelen, size_t totelelen) {
1248 if (zobj->encoding == OBJ_ENCODING_ZIPLIST) return;
1249 zset *zset = zobj->ptr;
1250
1251 if (zset->zsl->length <= server.zset_max_ziplist_entries &&
1252 maxelelen <= server.zset_max_ziplist_value &&
1253 ziplistSafeToAdd(NULL, totelelen))
1254 {
1255 zsetConvert(zobj,OBJ_ENCODING_ZIPLIST);
1256 }
1257}
1258
1259/* Return (by reference) the score of the specified member of the sorted set
1260 * storing it into *score. If the element does not exist C_ERR is returned

Callers 2

georadiusGenericFunction · 0.85

Calls 2

ziplistSafeToAddFunction · 0.85
zsetConvertFunction · 0.85

Tested by

no test coverage detected