1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
Bobby I. 20c16e0c2c (docs) add jsdoc comments to command parsers (#2984)
* (docs) bloom: add jsdocs for all commands

* (docs) json: add jsdocs

* (docs) search: add jsdocs for all commands

* (docs) jsdocs for std commands

* (docs) jsdoc comments to time series commands
2025-06-03 14:38:07 +03:00

37 lines
1.2 KiB
TypeScript

import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/lib/RESP/types';
export interface TopKReserveOptions {
width: number;
depth: number;
decay: number;
}
export default {
IS_READ_ONLY: false,
/**
* Creates a new Top-K filter with specified parameters
* @param parser - The command parser
* @param key - The name of the Top-K filter
* @param topK - Number of top occurring items to keep
* @param options - Optional parameters for filter configuration
* @param options.width - Number of counters in each array
* @param options.depth - Number of counter-arrays
* @param options.decay - Counter decay factor
*/
parseCommand(parser: CommandParser, key: RedisArgument, topK: number, options?: TopKReserveOptions) {
parser.push('TOPK.RESERVE');
parser.pushKey(key);
parser.push(topK.toString());
if (options) {
parser.push(
options.width.toString(),
options.depth.toString(),
options.decay.toString()
);
}
},
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
} as const satisfies Command;