You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
27 lines
756 B
TypeScript
27 lines
756 B
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,
|
|
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;
|