Redis-Cluster-Fast
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
deps/hiredis-cluster/hircluster.c view on Meta::CPAN
* Key space handling
* -------------------------------------------------------------------------- */
/* We have 16384 hash slots. The hash slot of a given key is obtained
* as the least significant 14 bits of the crc16 of the key.
*
* However if the key contains the {...} pattern, only the part between
* { and } is hashed. This may be useful in the future to force certain
* keys to be in the same node (assuming no resharding is in progress). */
static unsigned int keyHashSlot(char *key, int keylen) {
int s, e; /* start-end indexes of { and } */
for (s = 0; s < keylen; s++)
if (key[s] == '{')
break;
/* No '{' ? Hash the whole key. This is the base case. */
if (s == keylen)
return crc16(key, keylen) & 0x3FFF;
/* '{' found? Check if we have the corresponding '}'. */
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.524 second using v1.00-cache-2.02-grep-82fe00e-cpan-c30982ac1bc3 )