return 0;
}
-setIterator *setTypeInitIterator(robj *subject) {
- setIterator *si = zmalloc(sizeof(setIterator));
+setTypeIterator *setTypeInitIterator(robj *subject) {
+ setTypeIterator *si = zmalloc(sizeof(setTypeIterator));
si->subject = subject;
si->encoding = subject->encoding;
if (si->encoding == REDIS_ENCODING_HT) {
return si;
}
-void setTypeReleaseIterator(setIterator *si) {
+void setTypeReleaseIterator(setTypeIterator *si) {
if (si->encoding == REDIS_ENCODING_HT)
dictReleaseIterator(si->di);
zfree(si);
/* Move to the next entry in the set. Returns the object at the current
* position, or NULL when the end is reached. This object will have its
* refcount incremented, so the caller needs to take care of this. */
-robj *setTypeNext(setIterator *si) {
+robj *setTypeNext(setTypeIterator *si) {
robj *ret = NULL;
if (si->encoding == REDIS_ENCODING_HT) {
dictEntry *de = dictNext(si->di);
* to a hashtable) is presized to hold the number of elements in the original
* set. */
void setTypeConvert(robj *subject, int enc) {
- setIterator *si;
+ setTypeIterator *si;
robj *element;
redisAssert(subject->type == REDIS_SET);
}
}
if (setTypeAdd(set,c->argv[2])) {
+ touchWatchedKey(c->db,c->argv[1]);
server.dirty++;
addReply(c,shared.cone);
} else {
if (setTypeRemove(set,c->argv[2])) {
if (setTypeSize(set) == 0) dbDelete(c->db,c->argv[1]);
+ touchWatchedKey(c->db,c->argv[1]);
server.dirty++;
addReply(c,shared.cone);
} else {
/* Remove the src set from the database when empty */
if (setTypeSize(srcset) == 0) dbDelete(c->db,c->argv[1]);
+ touchWatchedKey(c->db,c->argv[1]);
+ touchWatchedKey(c->db,c->argv[2]);
server.dirty++;
/* Create the destination set when it doesn't exist */
addReplyBulk(c,ele);
decrRefCount(ele);
if (setTypeSize(set) == 0) dbDelete(c->db,c->argv[1]);
+ touchWatchedKey(c->db,c->argv[1]);
server.dirty++;
}
}
void sinterGenericCommand(redisClient *c, robj **setkeys, unsigned long setnum, robj *dstkey) {
robj **sets = zmalloc(sizeof(robj*)*setnum);
- setIterator *si;
+ setTypeIterator *si;
robj *ele, *lenobj = NULL, *dstset = NULL;
unsigned long j, cardinality = 0;
if (!setobj) {
zfree(sets);
if (dstkey) {
- if (dbDelete(c->db,dstkey))
+ if (dbDelete(c->db,dstkey)) {
+ touchWatchedKey(c->db,dstkey);
server.dirty++;
+ }
addReply(c,shared.czero);
} else {
addReply(c,shared.emptymultibulk);
decrRefCount(dstset);
addReply(c,shared.czero);
}
+ touchWatchedKey(c->db,dstkey);
server.dirty++;
} else {
lenobj->ptr = sdscatprintf(sdsempty(),"*%lu\r\n",cardinality);
void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum, robj *dstkey, int op) {
robj **sets = zmalloc(sizeof(robj*)*setnum);
- setIterator *si;
+ setTypeIterator *si;
robj *ele, *dstset = NULL;
int j, cardinality = 0;
decrRefCount(dstset);
addReply(c,shared.czero);
}
+ touchWatchedKey(c->db,dstkey);
server.dirty++;
}
zfree(sets);