dict.c: make chaining strategy more clear in dictAddRaw().

This commit is contained in:
antirez 2015-01-23 18:11:05 +01:00
parent 7885e1264e
commit 8aaf5075c5

View File

@ -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];