1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

(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
This commit is contained in:
Bobby I.
2025-06-03 14:38:07 +03:00
committed by GitHub
parent e4a1ca467f
commit 20c16e0c2c
491 changed files with 3861 additions and 1 deletions

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param item - The item to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('BF.ADD');
parser.pushKey(key);

View File

@@ -3,6 +3,11 @@ import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP
export default {
IS_READ_ONLY: true,
/**
* Returns the cardinality (number of items) in a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter to query
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('BF.CARD');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: true,
/**
* Checks if an item exists in a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param item - The item to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('BF.EXISTS');
parser.pushKey(key);

View File

@@ -12,6 +12,11 @@ export type BfInfoReplyMap = TuplesToMapReply<[
export default {
IS_READ_ONLY: true,
/**
* Returns information about a Bloom Filter, including capacity, size, number of filters, items inserted, and expansion rate
* @param parser - The command parser
* @param key - The name of the Bloom filter to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('BF.INFO');
parser.pushKey(key);

View File

@@ -13,6 +13,18 @@ export interface BfInsertOptions {
export default {
IS_READ_ONLY: false,
/**
* Adds one or more items to a Bloom Filter, creating it if it does not exist
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - Desired capacity for a new filter
* @param options.ERROR - Desired error rate for a new filter
* @param options.EXPANSION - Expansion rate for a new filter
* @param options.NOCREATE - If true, prevents automatic filter creation
* @param options.NONSCALING - Prevents the filter from creating additional sub-filters
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Restores a Bloom Filter chunk previously saved using SCANDUMP
* @param parser - The command parser
* @param key - The name of the Bloom filter to restore
* @param iterator - Iterator value from the SCANDUMP command
* @param chunk - Data chunk from the SCANDUMP command
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) {
parser.push('BF.LOADCHUNK');
parser.pushKey(key);

View File

@@ -5,6 +5,12 @@ import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/gene
export default {
IS_READ_ONLY: false,
/**
* Adds multiple items to a Bloom Filter in a single call
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('BF.MADD');
parser.pushKey(key);

View File

@@ -5,6 +5,12 @@ import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/gene
export default {
IS_READ_ONLY: true,
/**
* Checks if multiple items exist in a Bloom Filter in a single call
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('BF.MEXISTS');
parser.pushKey(key);

View File

@@ -8,6 +8,16 @@ export interface BfReserveOptions {
export default {
IS_READ_ONLY: true,
/**
* Creates an empty Bloom Filter with a given desired error ratio and initial capacity
* @param parser - The command parser
* @param key - The name of the Bloom filter to create
* @param errorRate - The desired probability for false positives (between 0 and 1)
* @param capacity - The number of entries intended to be added to the filter
* @param options - Optional parameters to tune the filter
* @param options.EXPANSION - Expansion rate for the filter
* @param options.NONSCALING - Prevents the filter from creating additional sub-filters
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -3,6 +3,12 @@ import { RedisArgument, TuplesReply, NumberReply, BlobStringReply, UnwrapReply,
export default {
IS_READ_ONLY: true,
/**
* Begins an incremental save of a Bloom Filter. This is useful for large filters that can't be saved at once
* @param parser - The command parser
* @param key - The name of the Bloom filter to save
* @param iterator - Iterator value; Start at 0, and use the iterator from the response for the next chunk
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number) {
parser.push('BF.SCANDUMP');
parser.pushKey(key);

View File

@@ -8,6 +8,12 @@ export interface BfIncrByItem {
export default {
IS_READ_ONLY: false,
/**
* Increases the count of one or more items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch
* @param items - A single item or array of items to increment, each with an item and increment value
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -16,6 +16,11 @@ export interface CmsInfoReply {
export default {
IS_READ_ONLY: true,
/**
* Returns width, depth, and total count of items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('CMS.INFO');
parser.pushKey(key);

View File

@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Initialize a Count-Min Sketch using width and depth parameters
* @param parser - The command parser
* @param key - The name of the sketch
* @param width - Number of counters in each array (must be a multiple of 2)
* @param depth - Number of counter arrays (determines accuracy of estimates)
*/
parseCommand(parser: CommandParser, key: RedisArgument, width: number, depth: number) {
parser.push('CMS.INITBYDIM');
parser.pushKey(key);

View File

@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Initialize a Count-Min Sketch using error rate and probability parameters
* @param parser - The command parser
* @param key - The name of the sketch
* @param error - Estimate error, as a decimal between 0 and 1
* @param probability - The desired probability for inflated count, as a decimal between 0 and 1
*/
parseCommand(parser: CommandParser, key: RedisArgument, error: number, probability: number) {
parser.push('CMS.INITBYPROB');
parser.pushKey(key);

View File

@@ -10,6 +10,12 @@ export type BfMergeSketches = Array<RedisArgument> | Array<BfMergeSketch>;
export default {
IS_READ_ONLY: false,
/**
* Merges multiple Count-Min Sketches into a single sketch, with optional weights
* @param parser - The command parser
* @param destination - The name of the destination sketch
* @param source - Array of sketch names or array of sketches with weights
*/
parseCommand(
parser: CommandParser,
destination: RedisArgument,

View File

@@ -4,6 +4,12 @@ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: true,
/**
* Returns the count for one or more items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch
* @param items - One or more items to get counts for
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('CMS.QUERY');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Cuckoo Filter, creating the filter if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.ADD');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Cuckoo Filter only if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to add to the filter if it doesn't exist
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.ADDNX');
parser.pushKey(key);

View File

@@ -3,6 +3,12 @@ import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP
export default {
IS_READ_ONLY: true,
/**
* Returns the number of times an item appears in a Cuckoo Filter
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to count occurrences of
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.COUNT');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Removes an item from a Cuckoo Filter if it exists
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to remove from the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.DEL');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Checks if an item exists in a Cuckoo Filter
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.EXISTS');
parser.pushKey(key);

View File

@@ -15,6 +15,11 @@ export type CfInfoReplyMap = TuplesToMapReply<[
export default {
IS_READ_ONLY: true,
/**
* Returns detailed information about a Cuckoo Filter including size, buckets, filters count, items statistics and configuration
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('CF.INFO');
parser.pushKey(key);

View File

@@ -29,6 +29,15 @@ export function parseCfInsertArguments(
export default {
IS_READ_ONLY: false,
/**
* Adds one or more items to a Cuckoo Filter, creating it if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - The number of entries intended to be added to the filter
* @param options.NOCREATE - If true, prevents automatic filter creation
*/
parseCommand(...args: Parameters<typeof parseCfInsertArguments>) {
args[0].push('CF.INSERT');
parseCfInsertArguments(...args);

View File

@@ -1,6 +1,15 @@
import { Command } from '@redis/client/dist/lib/RESP/types';
import INSERT, { parseCfInsertArguments } from './INSERT';
/**
* Adds one or more items to a Cuckoo Filter only if they do not exist yet, creating the filter if needed
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - The number of entries intended to be added to the filter
* @param options.NOCREATE - If true, prevents automatic filter creation
*/
export default {
IS_READ_ONLY: INSERT.IS_READ_ONLY,
parseCommand(...args: Parameters<typeof parseCfInsertArguments>) {

View File

@@ -3,6 +3,13 @@ import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Restores a Cuckoo Filter chunk previously saved using SCANDUMP
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to restore
* @param iterator - Iterator value from the SCANDUMP command
* @param chunk - Data chunk from the SCANDUMP command
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) {
parser.push('CF.LOADCHUNK');
parser.pushKey(key);

View File

@@ -9,6 +9,16 @@ export interface CfReserveOptions {
export default {
IS_READ_ONLY: false,
/**
* Creates an empty Cuckoo Filter with specified capacity and parameters
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to create
* @param capacity - The number of entries intended to be added to the filter
* @param options - Optional parameters to tune the filter
* @param options.BUCKETSIZE - Number of items in each bucket
* @param options.MAXITERATIONS - Maximum number of iterations before declaring filter full
* @param options.EXPANSION - Number of additional buckets per expansion
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -3,6 +3,12 @@ import { RedisArgument, TuplesReply, NumberReply, BlobStringReply, NullReply, Un
export default {
IS_READ_ONLY: true,
/**
* Begins an incremental save of a Cuckoo Filter. This is useful for large filters that can't be saved at once
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to save
* @param iterator - Iterator value; Start at 0, and use the iterator from the response for the next chunk
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number) {
parser.push('CF.SCANDUMP');
parser.pushKey(key);

View File

@@ -3,6 +3,12 @@ import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Adds one or more observations to a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param values - Array of numeric values to add to the sketch
*/
parseCommand(parser: CommandParser, key: RedisArgument, values: Array<number>) {
parser.push('TDIGEST.ADD');
parser.pushKey(key);

View File

@@ -16,6 +16,12 @@ export function transformByRankArguments(
export default {
IS_READ_ONLY: true,
/**
* Returns value estimates for one or more ranks in a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param ranks - Array of ranks to get value estimates for (ascending order)
*/
parseCommand(...args: Parameters<typeof transformByRankArguments>) {
args[0].push('TDIGEST.BYRANK');
transformByRankArguments(...args);

View File

@@ -1,6 +1,12 @@
import { Command } from '@redis/client/dist/lib/RESP/types';
import BYRANK, { transformByRankArguments } from './BYRANK';
/**
* Returns value estimates for one or more ranks in a t-digest sketch, starting from highest rank
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param ranks - Array of ranks to get value estimates for (descending order)
*/
export default {
IS_READ_ONLY: BYRANK.IS_READ_ONLY,
parseCommand(...args: Parameters<typeof transformByRankArguments>) {

View File

@@ -4,6 +4,12 @@ import { transformDoubleArrayReply } from '@redis/client/dist/lib/commands/gener
export default {
IS_READ_ONLY: true,
/**
* Estimates the cumulative distribution function for values in a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param values - Array of values to get CDF estimates for
*/
parseCommand(parser: CommandParser, key: RedisArgument, values: Array<number>) {
parser.push('TDIGEST.CDF');
parser.pushKey(key);

View File

@@ -7,6 +7,13 @@ export interface TDigestCreateOptions {
export default {
IS_READ_ONLY: false,
/**
* Creates a new t-digest sketch for storing distributions
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param options - Optional parameters for sketch creation
* @param options.COMPRESSION - Compression parameter that affects performance and accuracy
*/
parseCommand(parser: CommandParser, key: RedisArgument, options?: TDigestCreateOptions) {
parser.push('TDIGEST.CREATE');
parser.pushKey(key);

View File

@@ -16,6 +16,11 @@ export type TdInfoReplyMap = TuplesToMapReply<[
export default {
IS_READ_ONLY: true,
/**
* Returns information about a t-digest sketch including compression, capacity, nodes, weights, observations and memory usage
* @param parser - The command parser
* @param key - The name of the t-digest sketch to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TDIGEST.INFO');
parser.pushKey(key);

View File

@@ -4,6 +4,11 @@ import { transformDoubleReply } from '@redis/client/dist/lib/commands/generic-tr
export default {
IS_READ_ONLY: true,
/**
* Returns the maximum value from a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TDIGEST.MAX');
parser.pushKey(key);

View File

@@ -9,6 +9,15 @@ export interface TDigestMergeOptions {
export default {
IS_READ_ONLY: false,
/**
* Merges multiple t-digest sketches into one, with optional compression and override settings
* @param parser - The command parser
* @param destination - The name of the destination t-digest sketch
* @param source - One or more source sketch names to merge from
* @param options - Optional parameters for merge operation
* @param options.COMPRESSION - New compression value for merged sketch
* @param options.OVERRIDE - If true, override destination sketch if it exists
*/
parseCommand(
parser: CommandParser,
destination: RedisArgument,

View File

@@ -4,6 +4,11 @@ import { transformDoubleReply } from '@redis/client/dist/lib/commands/generic-tr
export default {
IS_READ_ONLY: true,
/**
* Returns the minimum value from a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TDIGEST.MIN');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { transformDoubleArrayReply } from '@redis/client/dist/lib/commands/gener
export default {
IS_READ_ONLY: true,
/**
* Returns value estimates at requested quantiles from a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param quantiles - Array of quantiles (between 0 and 1) to get value estimates for
*/
parseCommand(parser: CommandParser, key: RedisArgument, quantiles: Array<number>) {
parser.push('TDIGEST.QUANTILE');
parser.pushKey(key);

View File

@@ -15,6 +15,12 @@ export function transformRankArguments(
export default {
IS_READ_ONLY: true,
/**
* Returns the rank of one or more values in a t-digest sketch (number of values that are lower than each value)
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param values - Array of values to get ranks for
*/
parseCommand(...args: Parameters<typeof transformRankArguments>) {
args[0].push('TDIGEST.RANK');
transformRankArguments(...args);

View File

@@ -3,6 +3,11 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
export default {
IS_READ_ONLY: false,
/**
* Resets a t-digest sketch, clearing all previously added observations
* @param parser - The command parser
* @param key - The name of the t-digest sketch to reset
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TDIGEST.RESET');
parser.pushKey(key);

View File

@@ -1,6 +1,12 @@
import { Command } from '@redis/client/dist/lib/RESP/types';
import RANK, { transformRankArguments } from './RANK';
/**
* Returns the reverse rank of one or more values in a t-digest sketch (number of values that are higher than each value)
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param values - Array of values to get reverse ranks for
*/
export default {
IS_READ_ONLY: RANK.IS_READ_ONLY,
parseCommand(...args: Parameters<typeof transformRankArguments>) {

View File

@@ -4,6 +4,13 @@ import { transformDoubleReply } from '@redis/client/dist/lib/commands/generic-tr
export default {
IS_READ_ONLY: true,
/**
* Returns the mean value from a t-digest sketch after trimming values at specified percentiles
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param lowCutPercentile - Lower percentile cutoff (between 0 and 100)
* @param highCutPercentile - Higher percentile cutoff (between 0 and 100)
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -4,6 +4,12 @@ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: false,
/**
* Adds one or more items to a Top-K filter and returns items dropped from the top-K list
* @param parser - The command parser
* @param key - The name of the Top-K filter
* @param items - One or more items to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('TOPK.ADD');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-t
export default {
IS_READ_ONLY: true,
/**
* Returns the count of occurrences for one or more items in a Top-K filter
* @param parser - The command parser
* @param key - The name of the Top-K filter
* @param items - One or more items to get counts for
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('TOPK.COUNT');
parser.pushKey(key);

View File

@@ -12,6 +12,12 @@ function pushIncrByItem(parser: CommandParser, { item, incrementBy }: TopKIncrBy
export default {
IS_READ_ONLY: false,
/**
* Increases the score of one or more items in a Top-K filter by specified increments
* @param parser - The command parser
* @param key - The name of the Top-K filter
* @param items - A single item or array of items to increment, each with an item name and increment value
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,

View File

@@ -12,6 +12,11 @@ export type TopKInfoReplyMap = TuplesToMapReply<[
export default {
IS_READ_ONLY: true,
/**
* Returns configuration and statistics of a Top-K filter, including k, width, depth, and decay parameters
* @param parser - The command parser
* @param key - The name of the Top-K filter to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TOPK.INFO');
parser.pushKey(key);

View File

@@ -3,6 +3,11 @@ import { RedisArgument, ArrayReply, BlobStringReply, Command } from '@redis/clie
export default {
IS_READ_ONLY: true,
/**
* Returns all items in a Top-K filter
* @param parser - The command parser
* @param key - The name of the Top-K filter
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TOPK.LIST');
parser.pushKey(key);

View File

@@ -3,6 +3,11 @@ import { RedisArgument, ArrayReply, BlobStringReply, NumberReply, UnwrapReply, C
export default {
IS_READ_ONLY: true,
/**
* Returns all items in a Top-K filter with their respective counts
* @param parser - The command parser
* @param key - The name of the Top-K filter
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('TOPK.LIST');
parser.pushKey(key);

View File

@@ -4,6 +4,12 @@ import { RedisVariadicArgument, transformBooleanArrayReply } from '@redis/client
export default {
IS_READ_ONLY: false,
/**
* Checks if one or more items are in the Top-K list
* @param parser - The command parser
* @param key - The name of the Top-K filter
* @param items - One or more items to check in the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('TOPK.QUERY');
parser.pushKey(key);

View File

@@ -9,6 +9,16 @@ export interface TopKReserveOptions {
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);