mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 20:00:00 +00:00
Remove sorted set when empty after ZREMRANGEBY*
This commit is contained in:
parent
dddf5335f4
commit
48991620f7
@ -1012,6 +1012,7 @@ void zremrangebyscoreCommand(redisClient *c) {
|
||||
|
||||
if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
|
||||
zobj->ptr = zzlDeleteRangeByScore(zobj->ptr,range,&deleted);
|
||||
if (zzlLength(zobj->ptr) == 0) dbDelete(c->db,key);
|
||||
} else if (zobj->encoding == REDIS_ENCODING_RAW) {
|
||||
zset *zs = zobj->ptr;
|
||||
deleted = zslDeleteRangeByScore(zs->zsl,range,zs->dict);
|
||||
@ -1057,6 +1058,7 @@ void zremrangebyrankCommand(redisClient *c) {
|
||||
if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
|
||||
/* Correct for 1-based rank. */
|
||||
zobj->ptr = zzlDeleteRangeByRank(zobj->ptr,start+1,end+1,&deleted);
|
||||
if (zzlLength(zobj->ptr) == 0) dbDelete(c->db,key);
|
||||
} else if (zobj->encoding == REDIS_ENCODING_RAW) {
|
||||
zset *zs = zobj->ptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user