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. */
| 1245 | * and if the number of elements and the maximum element size and total elements size |
| 1246 | * are within the expected ranges. */ |
| 1247 | void 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 |
no test coverage detected