diff options
author | antirez <antirez@gmail.com> | 2015-01-23 18:11:05 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-01-23 18:11:05 +0100 |
commit | 8aaf5075c5bb76492e56188090f33266d5a7ad46 (patch) | |
tree | 84be5a1123de8655723c0befdccfb9e8f201ce52 /src/dict.c | |
parent | 7885e1264e561afcc0182dd4763903def5138aa8 (diff) | |
download | redis-8aaf5075c5bb76492e56188090f33266d5a7ad46.tar.gz |
dict.c: make chaining strategy more clear in dictAddRaw().
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dict.c b/src/dict.c index 29d400099..7d8db3631 100644 --- a/src/dict.c +++ b/src/dict.c @@ -342,7 +342,10 @@ dictEntry *dictAddRaw(dict *d, void *key) if ((index = _dictKeyIndex(d, key)) == -1) return NULL; - /* Allocate the memory and store the new entry */ + /* Allocate the memory and store the new entry. + * Insert the element in top, with the assumption that in a database + * system it is more likely that recently added entries are accessed + * more frequently. */ ht = dictIsRehashing(d) ? &d->ht[1] : &d->ht[0]; entry = zmalloc(sizeof(*entry)); entry->next = ht->table[index]; |