You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Updates topk example for new withcount option. (#2093)
This commit is contained in:
@@ -66,6 +66,24 @@ async function topK() {
|
||||
// ]
|
||||
console.log(top10);
|
||||
|
||||
// List out the top 10 with their counts (requires RedisBloom >=2.2.9)
|
||||
const top10WithCounts = await client.topK.listWithCount('mytopk');
|
||||
console.log('The top 10 with counts:');
|
||||
console.log(top10WithCounts);
|
||||
// top10WithCounts looks like this:
|
||||
// [
|
||||
// { item: 'suze', count: 42363 },
|
||||
// { item: 'lance', count: 41982 },
|
||||
// { item: 'simon', count: 41831 },
|
||||
// { item: 'steve', count: 39237 },
|
||||
// { item: 'guy', count: 39078 },
|
||||
// { item: 'kyleb', count: 37338 },
|
||||
// { item: 'leibale', count: 34230 },
|
||||
// { item: 'kyleo', count: 33812 },
|
||||
// { item: 'alex', count: 33679 },
|
||||
// { item: 'nava', count: 32663 }
|
||||
// ]
|
||||
|
||||
// Check if a few team members are in the top 10 with TOPK.QUERY:
|
||||
const [ steve, suze, leibale, frederick ] = await client.topK.query('mytopk', [
|
||||
'steve',
|
||||
|
Reference in New Issue
Block a user