mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Modules: ZSET API WIP.
This commit is contained in:
parent
11b3df24cb
commit
f199504ac9
15
src/module.c
15
src/module.c
@ -145,6 +145,9 @@ int moduleCreateEmtpyKey(RedisModuleKey *key, int type) {
|
|||||||
quicklistSetOptions(obj->ptr, server.list_max_ziplist_size,
|
quicklistSetOptions(obj->ptr, server.list_max_ziplist_size,
|
||||||
server.list_compress_depth);
|
server.list_compress_depth);
|
||||||
break;
|
break;
|
||||||
|
case REDISMODULE_KEYTYPE_ZSET:
|
||||||
|
obj = createZsetZiplistObject();
|
||||||
|
break;
|
||||||
default: return REDISMODULE_ERR;
|
default: return REDISMODULE_ERR;
|
||||||
}
|
}
|
||||||
dbAdd(key->db,key->key,obj);
|
dbAdd(key->db,key->key,obj);
|
||||||
@ -805,7 +808,6 @@ int RM_ListPush(RedisModuleKey *key, int where, RedisModuleString *ele) {
|
|||||||
if (key->value->type != OBJ_LIST) return REDISMODULE_ERR;
|
if (key->value->type != OBJ_LIST) return REDISMODULE_ERR;
|
||||||
listTypePush(key->value, ele,
|
listTypePush(key->value, ele,
|
||||||
(where == REDISMODULE_LIST_HEAD) ? QUICKLIST_HEAD : QUICKLIST_TAIL);
|
(where == REDISMODULE_LIST_HEAD) ? QUICKLIST_HEAD : QUICKLIST_TAIL);
|
||||||
signalModifiedKey(key->db,key->key);
|
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,6 +831,17 @@ RedisModuleString *RM_ListPop(RedisModuleKey *key, int where) {
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------
|
||||||
|
* Key API for Sorted Set type
|
||||||
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int RM_ZsetAdd(RedisModuleKey *key, double score, RedisModuleString *ele) {
|
||||||
|
if (!(key->mode & REDISMODULE_WRITE)) return REDISMODULE_ERR;
|
||||||
|
if (key->value == NULL) moduleCreateEmtpyKey(key,REDISMODULE_KEYTYPE_ZSET);
|
||||||
|
if (key->value->type != OBJ_ZSET) return REDISMODULE_ERR;
|
||||||
|
return REDISMODULE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
* Redis <-> Modules generic Call() API
|
* Redis <-> Modules generic Call() API
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
@ -634,10 +634,6 @@ Work in progress.
|
|||||||
|
|
||||||
Work in progress.
|
Work in progress.
|
||||||
|
|
||||||
## Accessing keys TTL and setting expires
|
|
||||||
|
|
||||||
Work in progress.
|
|
||||||
|
|
||||||
# Replicating commands
|
# Replicating commands
|
||||||
|
|
||||||
If you want to use module commands exactly like normal Redis commands, in the
|
If you want to use module commands exactly like normal Redis commands, in the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user