MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dictEncObjHash

Function dictEncObjHash

app/redis-6.2.6/src/server.c:1338–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1336}
1337
1338uint64_t dictEncObjHash(const void *key) {
1339 robj *o = (robj*) key;
1340
1341 if (sdsEncodedObject(o)) {
1342 return dictGenHashFunction(o->ptr, sdslen((sds)o->ptr));
1343 } else if (o->encoding == OBJ_ENCODING_INT) {
1344 char buf[32];
1345 int len;
1346
1347 len = ll2string(buf,32,(long)o->ptr);
1348 return dictGenHashFunction((unsigned char*)buf, len);
1349 } else {
1350 serverPanic("Unknown string encoding");
1351 }
1352}
1353
1354/* Return 1 if currently we allow dict to expand. Dict may allocate huge
1355 * memory to contain hash buckets when dict expands, that may lead redis

Callers

nothing calls this directly

Calls 3

sdslenFunction · 0.85
ll2stringFunction · 0.85
dictGenHashFunctionFunction · 0.70

Tested by

no test coverage detected