Use hash of key as priority. Vendor xxhash v0.8.2
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <unordered_set>
|
||||
#include <xxhash.h>
|
||||
|
||||
void *mmapSafe(void *addr, size_t len, int prot, int flags, int fd,
|
||||
off_t offset) {
|
||||
@@ -86,7 +87,7 @@ struct Entry {
|
||||
e->keyLen = keyLen;
|
||||
e->valLen = valLen;
|
||||
e->refCount = 1;
|
||||
e->priority = rand(); // TODO
|
||||
e->priority = XXH3_64bits(key, keyLen);
|
||||
e->clearTo = clearTo;
|
||||
memcpy((uint8_t *)e->getKey(), key, keyLen);
|
||||
((uint8_t *)e->getKey())[keyLen] = 0;
|
||||
|
Reference in New Issue
Block a user