| 282 | } |
| 283 | |
| 284 | bool dbAddCore(redisDb *db, sds key, robj *val, bool fUpdateMvcc, bool fAssumeNew = false, dict_iter *piterExisting = nullptr, bool fValExpires = false) { |
| 285 | serverAssert(fValExpires || !val->FExpires()); |
| 286 | sds copy = sdsdupshared(key); |
| 287 | |
| 288 | uint64_t mvcc = getMvccTstamp(); |
| 289 | if (fUpdateMvcc) { |
| 290 | setMvccTstamp(val, mvcc); |
| 291 | } |
| 292 | |
| 293 | bool fInserted = db->insert(copy, val, fAssumeNew, piterExisting); |
| 294 | |
| 295 | if (fInserted) |
| 296 | { |
| 297 | signalKeyAsReady(db, key, val->type); |
| 298 | if (g_pserver->cluster_enabled) slotToKeyAdd(key); |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | sdsfree(copy); |
| 303 | } |
| 304 | |
| 305 | return fInserted; |
| 306 | } |
| 307 | |
| 308 | /* Add the key to the DB. It's up to the caller to increment the reference |
| 309 | * counter of the value if needed. |
no test coverage detected