diff options
author | antirez <antirez@gmail.com> | 2016-09-14 15:10:53 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-09-14 16:37:53 +0200 |
commit | a636aeac07240fea0acb6066bf1752d0913a9b4e (patch) | |
tree | 844163d2dd60f463a7e6dfb509aa34480997b02c /src/lazyfree.c | |
parent | afcbcc0e58749ebbebcd595c120d17a0e3dbb82e (diff) | |
download | redis-a636aeac07240fea0acb6066bf1752d0913a9b4e.tar.gz |
Apply the new dictUnlink() where possible.
Optimizations suggested and originally implemented by @oranagra.
Re-applied by @antirez using the modified API.
Diffstat (limited to 'src/lazyfree.c')
-rw-r--r-- | src/lazyfree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lazyfree.c b/src/lazyfree.c index dba3f00e2..c05252159 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -57,7 +57,7 @@ int dbAsyncDelete(redisDb *db, robj *key) { /* If the value is composed of a few allocations, to free in a lazy way * is actually just slower... So under a certain limit we just free * the object synchronously. */ - dictEntry *de = dictFind(db->dict,key->ptr); + dictEntry *de = dictUnlink(db->dict,key->ptr); if (de) { robj *val = dictGetVal(de); size_t free_effort = lazyfreeGetFreeEffort(val); @@ -73,7 +73,8 @@ int dbAsyncDelete(redisDb *db, robj *key) { /* Release the key-val pair, or just the key if we set the val * field to NULL in order to lazy free it later. */ - if (dictDelete(db->dict,key->ptr) == DICT_OK) { + if (de) { + dictFreeUnlinkedEntry(db->dict,de); if (server.cluster_enabled) slotToKeyDel(key); return 1; } else { |