You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
32 lines
863 B
TypeScript
32 lines
863 B
TypeScript
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisVariadicArgument, pushVariadicArguments } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
|
|
export interface BfReserveOptions {
|
|
EXPANSION?: number;
|
|
NONSCALING?: boolean;
|
|
}
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 1,
|
|
IS_READ_ONLY: true,
|
|
transformArguments(
|
|
key: RedisArgument,
|
|
errorRate: number,
|
|
capacity: number,
|
|
options?: BfReserveOptions
|
|
) {
|
|
const args = ['BF.RESERVE', key, errorRate.toString(), capacity.toString()];
|
|
|
|
if (options?.EXPANSION) {
|
|
args.push('EXPANSION', options.EXPANSION.toString());
|
|
}
|
|
|
|
if (options?.NONSCALING) {
|
|
args.push('NONSCALING');
|
|
}
|
|
|
|
return args;
|
|
},
|
|
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
|
} as const satisfies Command;
|