MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / dictEncObjHash

Function dictEncObjHash

src/server.cpp:1432–1446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430}
1431
1432uint64_t dictEncObjHash(const void *key) {
1433 robj *o = (robj*) key;
1434
1435 if (sdsEncodedObject(o)) {
1436 return dictGenHashFunction(ptrFromObj(o), sdslen((sds)ptrFromObj(o)));
1437 } else if (o->encoding == OBJ_ENCODING_INT) {
1438 char buf[32];
1439 int len;
1440
1441 len = ll2string(buf,32,(long)ptrFromObj(o));
1442 return dictGenHashFunction((unsigned char*)buf, len);
1443 } else {
1444 serverPanic("Unknown string encoding");
1445 }
1446}
1447
1448/* Return 1 if currently we allow dict to expand. Dict may allocate huge
1449 * memory to contain hash buckets when dict expands, that may lead redis

Callers

nothing calls this directly

Calls 4

ptrFromObjFunction · 0.85
sdslenFunction · 0.85
ll2stringFunction · 0.85
dictGenHashFunctionFunction · 0.70

Tested by

no test coverage detected