Remove the specified element from the sorted set. * The function returns REDISMODULE_OK on success, and REDISMODULE_ERR * on one of the following conditions: * * * The key was not opened for writing. * * The key is of the wrong type. * * The return value does NOT indicate the fact the element was really * removed (since it existed) or not, just if the function was executed * with success.
| 2710 | * |
| 2711 | * Empty keys will be handled correctly by doing nothing. */ |
| 2712 | int RM_ZsetRem(RedisModuleKey *key, RedisModuleString *ele, int *deleted) { |
| 2713 | if (!(key->mode & REDISMODULE_WRITE)) return REDISMODULE_ERR; |
| 2714 | if (key->value && key->value->type != OBJ_ZSET) return REDISMODULE_ERR; |
| 2715 | if (key->value != NULL && zsetDel(key->value,ele->ptr)) { |
| 2716 | if (deleted) *deleted = 1; |
| 2717 | moduleDelKeyIfEmpty(key); |
| 2718 | } else { |
| 2719 | if (deleted) *deleted = 0; |
| 2720 | } |
| 2721 | return REDISMODULE_OK; |
| 2722 | } |
| 2723 | |
| 2724 | /* On success retrieve the double score associated at the sorted set element |
| 2725 | * 'ele' and returns REDISMODULE_OK. Otherwise REDISMODULE_ERR is returned |
nothing calls this directly
no test coverage detected