mirror of
https://github.com/fluencelabs/redis
synced 2025-06-16 10:41:22 +00:00
Replicate EVALSHA as EVAL taking a dictionary of sha1 -> script source code.
This commit is contained in:
17
src/object.c
17
src/object.c
@ -192,6 +192,23 @@ void decrRefCount(void *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
/* This function set the ref count to zero without freeing the object.
|
||||
* It is useful in order to pass a new object to functions incrementing
|
||||
* the ref count of the received object. Example:
|
||||
*
|
||||
* functionThatWillIncrementRefCount(resetRefCount(CreateObject(...)));
|
||||
*
|
||||
* Otherwise you need to resort to the less elegant pattern:
|
||||
*
|
||||
* *obj = createObject(...);
|
||||
* functionThatWillIncrementRefCount(obj);
|
||||
* decrRefCount(obj);
|
||||
*/
|
||||
robj *resetRefCount(robj *obj) {
|
||||
obj->refcount = 0;
|
||||
return obj;
|
||||
}
|
||||
|
||||
int checkType(redisClient *c, robj *o, int type) {
|
||||
if (o->type != type) {
|
||||
addReply(c,shared.wrongtypeerr);
|
||||
|
Reference in New Issue
Block a user