Add the key to the DB. It's up to the caller to increment the reference * counter of the value if needed. * * The program is aborted if the key already exists. */
| 191 | * |
| 192 | * The program is aborted if the key already exists. */ |
| 193 | void dbAdd(redisDb *db, robj *key, robj *val) { |
| 194 | sds copy = sdsdup(key->ptr); |
| 195 | int retval = dictAdd(db->dict, copy, val); |
| 196 | |
| 197 | serverAssertWithInfo(NULL,key,retval == DICT_OK); |
| 198 | signalKeyAsReady(db, key, val->type); |
| 199 | if (server.cluster_enabled) slotToKeyAdd(key->ptr); |
| 200 | } |
| 201 | |
| 202 | /* This is a special version of dbAdd() that is used only when loading |
| 203 | * keys from the RDB file: the key is passed as an SDS string that is |
no test coverage detected