High level Set operation. This function can be used in order to set * a key, whatever it was existing or not, to a new object. * * 1) The ref count of the value object is incremented. * 2) clients WATCHing for the destination key notified. * 3) The expire time of the key is reset (the key is made persistent), * unless 'keepttl' is true. * * All the new keys in the database should be cre
| 408 | * The client 'c' argument may be set to NULL if the operation is performed |
| 409 | * in a context where there is no clear client performing the operation. */ |
| 410 | void genericSetKey(client *c, redisDb *db, robj *key, robj *val, int keepttl, int signal) { |
| 411 | db->prepOverwriteForSnapshot(szFromObj(key)); |
| 412 | dict_iter iter; |
| 413 | if (!dbAddCore(db, szFromObj(key), val, true /* fUpdateMvcc */, false /*fAssumeNew*/, &iter)) { |
| 414 | dbOverwrite(db, key, val, !keepttl, &iter); |
| 415 | } |
| 416 | incrRefCount(val); |
| 417 | if (signal) signalModifiedKey(c,db,key); |
| 418 | } |
| 419 | |
| 420 | /* Common case for genericSetKey() where the TTL is not retained. */ |
| 421 | void setKey(client *c, redisDb *db, robj *key, robj *val) { |
no test coverage detected