Replicate EVALSHA as EVAL taking a dictionary of sha1 -> script source code.

This commit is contained in:
antirez
2011-07-13 15:38:03 +02:00
parent 70ecddc9f4
commit 4dd444bb4a
5 changed files with 79 additions and 3 deletions

View File

@ -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);