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.
| 2798 | * |
| 2799 | * Empty keys will be handled correctly by doing nothing. */ |
| 2800 | int RM_ZsetRem(RedisModuleKey *key, RedisModuleString *ele, int *deleted) { |
| 2801 | if (!(key->mode & REDISMODULE_WRITE)) return REDISMODULE_ERR; |
| 2802 | if (key->value && key->value->type != OBJ_ZSET) return REDISMODULE_ERR; |
| 2803 | if (key->value != NULL && zsetDel(key->value,szFromObj(ele))) { |
| 2804 | if (deleted) *deleted = 1; |
| 2805 | moduleDelKeyIfEmpty(key); |
| 2806 | } else { |
| 2807 | if (deleted) *deleted = 0; |
| 2808 | } |
| 2809 | return REDISMODULE_OK; |
| 2810 | } |
| 2811 | |
| 2812 | /* On success retrieve the double score associated at the sorted set element |
| 2813 | * 'ele' and returns REDISMODULE_OK. Otherwise REDISMODULE_ERR is returned |
nothing calls this directly
no test coverage detected