MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dbSyncDelete

Function dbSyncDelete

app/redis-6.2.6/src/db.c:315–330  ·  view source on GitHub ↗

Delete a key, value, and associated expiration entry if any, from the DB */

Source from the content-addressed store, hash-verified

313
314/* Delete a key, value, and associated expiration entry if any, from the DB */
315int 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. */

Callers 8

expireGenericCommandFunction · 0.85
getexCommandFunction · 0.85
getdelCommandFunction · 0.85
performEvictionsFunction · 0.85
rdbLoadRioFunction · 0.85
dbDeleteFunction · 0.85
delGenericCommandFunction · 0.85

Calls 5

dictUnlinkFunction · 0.85
moduleNotifyKeyUnlinkFunction · 0.85
dictFreeUnlinkedEntryFunction · 0.85
slotToKeyDelFunction · 0.85
dictDeleteFunction · 0.70

Tested by

no test coverage detected