Delete a key, value, and associated expiration entry if any, from the DB */
| 313 | |
| 314 | /* Delete a key, value, and associated expiration entry if any, from the DB */ |
| 315 | int dbSyncDelete(redisDb *db, robj *key) { |
| 316 | /* Deleting an entry from the expires dict will not free the sds of |
| 317 | * the key, because it is shared with the main dictionary. */ |
| 318 | if (dictSize(db->expires) > 0) dictDelete(db->expires,key->ptr); |
| 319 | dictEntry *de = dictUnlink(db->dict,key->ptr); |
| 320 | if (de) { |
| 321 | robj *val = dictGetVal(de); |
| 322 | /* Tells the module that the key has been unlinked from the database. */ |
| 323 | moduleNotifyKeyUnlink(key,val); |
| 324 | dictFreeUnlinkedEntry(db->dict,de); |
| 325 | if (server.cluster_enabled) slotToKeyDel(key->ptr); |
| 326 | return 1; |
| 327 | } else { |
| 328 | return 0; |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | /* This is a wrapper whose behavior depends on the Redis lazy free |
| 333 | * configuration. Deletes the key synchronously or asynchronously. */ |
no test coverage detected