1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/bloom/lib/commands/cuckoo/RESERVE.ts
2023-07-05 15:22:33 -04:00

35 lines
905 B
TypeScript

import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
export interface CfReserveOptions {
BUCKETSIZE?: number;
MAXITERATIONS?: number;
EXPANSION?: number;
}
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(
key: RedisArgument,
capacity: number,
options?: CfReserveOptions
) {
const args = ['CF.RESERVE', key, capacity.toString()];
if (options?.BUCKETSIZE !== undefined) {
args.push('BUCKETSIZE', options.BUCKETSIZE.toString());
}
if (options?.MAXITERATIONS !== undefined) {
args.push('MAXITERATIONS', options.MAXITERATIONS.toString());
}
if (options?.EXPANSION !== undefined) {
args.push('EXPANSION', options.EXPANSION.toString());
}
return args;
},
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
} as const satisfies Command;