Gathering detailed insights and metrics for cluster-key-slot
Gathering detailed insights and metrics for cluster-key-slot
Gathering detailed insights and metrics for cluster-key-slot
Gathering detailed insights and metrics for cluster-key-slot
Generates CRC hashes for strings - for use by Node Redis clients to determine key slots.
npm install cluster-key-slot
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
22 Stars
55 Commits
11 Forks
11 Watchers
2 Branches
15 Contributors
Updated on Apr 18, 2025
Latest Version
1.1.2
Package Id
cluster-key-slot@1.1.2
Unpacked Size
11.89 kB
Size
5.13 kB
File Count
6
NPM Version
8.11.0
Node Version
18.3.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A high performance redis cluster key slot calculator for node redis clients e.g. node_redis, ioredis and redis-clustr.
This also handles key tags such as somekey{actualTag}
.
Install with NPM:
npm install cluster-key-slot --save
1const calculateSlot = require('cluster-key-slot');
2const calculateMultipleSlots = require('cluster-key-slot').generateMulti;
3
4// ...
5
6// a single slot number
7const slot = calculateSlot('test:key:{butOnlyThis}redis');
8// Buffer is also supported
9const anotherSlot = calculateSlot(Buffer.from([0x7b, 0x7d, 0x2a]));
10
11// multiple keys - multi returns a single key slot number, returns -1 if any
12// of the keys does not match the base slot number (base is defaulted to first keys slot)
13// This is useful to quickly determine a singe slot for multi keys operations.
14const slotForRedisMulti = calculateMultipleSlots([
15 'test:key:{butOnlyThis}redis',
16 'something:key45:{butOnlyThis}hello',
17 'example:key46:{butOnlyThis}foobar',
18]);
OLD
in these benchmarks refers to the ioredis
crc calc and many of the other calculators that use Buffer
.
1node -v ✔ 16.38G RAM 10:29:07 2v10.15.3 3 4NEW tags x 721,445 ops/sec ±0.44% (90 runs sampled) 5OLD tags x 566,777 ops/sec ±0.97% (96 runs sampled) 6NEW without tags x 2,054,845 ops/sec ±1.77% (92 runs sampled) 7OLD without tags x 865,839 ops/sec ±0.43% (96 runs sampled) 8NEW without tags singular x 6,354,097 ops/sec ±1.25% (94 runs sampled) 9OLD without tags singular x 4,012,250 ops/sec ±0.96% (94 runs sampled) 10NEW tags (Buffer) x 552,346 ops/sec ±1.35% (92 runs sampled)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More