You've already forked node-redis
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:
@@ -4,6 +4,11 @@ import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/typ
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Lists ACL categories or commands in a category
|
||||
* @param parser - The Redis command parser
|
||||
* @param categoryName - Optional category name to filter commands
|
||||
*/
|
||||
parseCommand(parser: CommandParser, categoryName?: RedisArgument) {
|
||||
parser.push('ACL', 'CAT');
|
||||
if (categoryName) {
|
||||
|
@@ -5,6 +5,11 @@ import { RedisVariadicArgument } from './generic-transformers';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Deletes one or more users from the ACL
|
||||
* @param parser - The Redis command parser
|
||||
* @param username - Username(s) to delete
|
||||
*/
|
||||
parseCommand(parser: CommandParser, username: RedisVariadicArgument) {
|
||||
parser.push('ACL', 'DELUSER');
|
||||
parser.pushVariadic(username);
|
||||
|
@@ -4,6 +4,12 @@ import { RedisArgument, SimpleStringReply, BlobStringReply, Command } from '../R
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Simulates ACL operations without executing them
|
||||
* @param parser - The Redis command parser
|
||||
* @param username - Username to simulate ACL operations for
|
||||
* @param command - Command arguments to simulate
|
||||
*/
|
||||
parseCommand(parser: CommandParser, username: RedisArgument, command: Array<RedisArgument>) {
|
||||
parser.push('ACL', 'DRYRUN', username, ...command);
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Generates a secure password for ACL users
|
||||
* @param parser - The Redis command parser
|
||||
* @param bits - Optional number of bits for password entropy
|
||||
*/
|
||||
parseCommand(parser: CommandParser, bits?: number) {
|
||||
parser.push('ACL', 'GENPASS');
|
||||
if (bits) {
|
||||
|
@@ -20,6 +20,11 @@ type AclUser = TuplesToMapReply<[
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns ACL information about a specific user
|
||||
* @param parser - The Redis command parser
|
||||
* @param username - Username to get information for
|
||||
*/
|
||||
parseCommand(parser: CommandParser, username: RedisArgument) {
|
||||
parser.push('ACL', 'GETUSER', username);
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns all configured ACL users and their permissions
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'LIST');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Reloads ACL configuration from the ACL file
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'LOAD');
|
||||
},
|
||||
|
@@ -21,6 +21,11 @@ export type AclLogReply = ArrayReply<TuplesToMapReply<[
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns ACL security events log entries
|
||||
* @param parser - The Redis command parser
|
||||
* @param count - Optional maximum number of entries to return
|
||||
*/
|
||||
parseCommand(parser: CommandParser, count?: number) {
|
||||
parser.push('ACL', 'LOG');
|
||||
if (count != undefined) {
|
||||
|
@@ -5,6 +5,10 @@ import ACL_LOG from './ACL_LOG';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: ACL_LOG.IS_READ_ONLY,
|
||||
/**
|
||||
* Clears the ACL security events log
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'LOG', 'RESET');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Saves the current ACL configuration to the ACL file
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'SAVE');
|
||||
},
|
||||
|
@@ -5,6 +5,12 @@ import { RedisVariadicArgument } from './generic-transformers';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Creates or modifies ACL user with specified rules
|
||||
* @param parser - The Redis command parser
|
||||
* @param username - Username to create or modify
|
||||
* @param rule - ACL rule(s) to apply to the user
|
||||
*/
|
||||
parseCommand(parser: CommandParser, username: RedisArgument, rule: RedisVariadicArgument) {
|
||||
parser.push('ACL', 'SETUSER', username);
|
||||
parser.pushVariadic(rule);
|
||||
|
@@ -4,6 +4,10 @@ import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns a list of all configured ACL usernames
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'USERS');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the username of the current connection
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('ACL', 'WHOAMI');
|
||||
},
|
||||
|
@@ -3,6 +3,12 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Appends a value to a string key
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key to append to
|
||||
* @param value - The value to append
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, value: RedisArgument) {
|
||||
parser.push('APPEND', key, value);
|
||||
},
|
||||
|
@@ -6,6 +6,10 @@ export const ASKING_CMD = 'ASKING';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Tells a Redis cluster node that the client is ok receiving such redirects
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push(ASKING_CMD);
|
||||
},
|
||||
|
@@ -9,6 +9,13 @@ export interface AuthOptions {
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Authenticates the connection using a password or username and password
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Authentication options containing username and/or password
|
||||
* @param options.username - Optional username for authentication
|
||||
* @param options.password - Password for authentication
|
||||
*/
|
||||
parseCommand(parser: CommandParser, { username, password }: AuthOptions) {
|
||||
parser.push('AUTH');
|
||||
if (username !== undefined) {
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Asynchronously rewrites the append-only file
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('BGREWRITEAOF');
|
||||
},
|
||||
|
@@ -8,6 +8,12 @@ export interface BgSaveOptions {
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Asynchronously saves the dataset to disk
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Optional configuration
|
||||
* @param options.SCHEDULE - Schedule a BGSAVE operation when no BGSAVE is already in progress
|
||||
*/
|
||||
parseCommand(parser: CommandParser, options?: BgSaveOptions) {
|
||||
parser.push('BGSAVE');
|
||||
if (options?.SCHEDULE) {
|
||||
|
@@ -10,6 +10,15 @@ export interface BitCountRange {
|
||||
export default {
|
||||
CACHEABLE: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the count of set bits in a string key
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key to count bits in
|
||||
* @param range - Optional range specification
|
||||
* @param range.start - Start offset in bytes/bits
|
||||
* @param range.end - End offset in bytes/bits
|
||||
* @param range.mode - Optional counting mode: BYTE or BIT
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, range?: BitCountRange) {
|
||||
parser.push('BITCOUNT');
|
||||
parser.pushKey(key);
|
||||
|
@@ -41,6 +41,12 @@ export type BitFieldRoOperations = Array<
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Performs arbitrary bitfield integer operations on strings
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key holding the string
|
||||
* @param operations - Array of bitfield operations to perform: GET, SET, INCRBY or OVERFLOW
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, operations: BitFieldOperations) {
|
||||
parser.push('BITFIELD');
|
||||
parser.pushKey(key);
|
||||
|
@@ -9,6 +9,12 @@ export type BitFieldRoOperations = Array<
|
||||
export default {
|
||||
CACHEABLE: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Performs read-only bitfield integer operations on strings
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key holding the string
|
||||
* @param operations - Array of GET operations to perform on the bitfield
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, operations: BitFieldRoOperations) {
|
||||
parser.push('BITFIELD_RO');
|
||||
parser.pushKey(key);
|
||||
|
@@ -6,6 +6,13 @@ export type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Performs bitwise operations between strings
|
||||
* @param parser - The Redis command parser
|
||||
* @param operation - Bitwise operation to perform: AND, OR, XOR, NOT
|
||||
* @param destKey - Destination key to store the result
|
||||
* @param key - Source key(s) to perform operation on
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
operation: BitOperations,
|
||||
|
@@ -5,6 +5,15 @@ import { BitValue } from './generic-transformers';
|
||||
export default {
|
||||
CACHEABLE: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the position of first bit set to 0 or 1 in a string
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key holding the string
|
||||
* @param bit - The bit value to look for (0 or 1)
|
||||
* @param start - Optional starting position in bytes/bits
|
||||
* @param end - Optional ending position in bytes/bits
|
||||
* @param mode - Optional counting mode: BYTE or BIT
|
||||
*/
|
||||
parseCommand(parser: CommandParser,
|
||||
key: RedisArgument,
|
||||
bit: BitValue,
|
||||
|
@@ -4,6 +4,15 @@ import { ListSide } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Pop an element from a list, push it to another list and return it; or block until one is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param source - Key of the source list
|
||||
* @param destination - Key of the destination list
|
||||
* @param sourceSide - Side of source list to pop from (LEFT or RIGHT)
|
||||
* @param destinationSide - Side of destination list to push to (LEFT or RIGHT)
|
||||
* @param timeout - Timeout in seconds, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
source: RedisArgument,
|
||||
|
@@ -4,6 +4,12 @@ import LMPOP, { LMPopArguments, parseLMPopArguments } from './LMPOP';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Pops elements from multiple lists; blocks until elements are available
|
||||
* @param parser - The Redis command parser
|
||||
* @param timeout - Timeout in seconds, 0 to block indefinitely
|
||||
* @param args - Additional arguments for LMPOP command
|
||||
*/
|
||||
parseCommand(parser: CommandParser, timeout: number, ...args: LMPopArguments) {
|
||||
parser.push('BLMPOP', timeout.toString());
|
||||
parseLMPopArguments(parser, ...args);
|
||||
|
@@ -4,6 +4,12 @@ import { RedisVariadicArgument } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Removes and returns the first element in a list, or blocks until one is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key of the list to pop from, or array of keys to try sequentially
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisVariadicArgument, timeout: number) {
|
||||
parser.push('BLPOP');
|
||||
parser.pushKeys(key);
|
||||
|
@@ -5,6 +5,12 @@ import BLPOP from './BLPOP';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Removes and returns the last element in a list, or blocks until one is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key of the list to pop from, or array of keys to try sequentially
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisVariadicArgument, timeout: number) {
|
||||
parser.push('BRPOP');
|
||||
parser.pushKeys(key);
|
||||
|
@@ -3,6 +3,13 @@ import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/type
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Pops an element from a list, pushes it to another list and returns it; blocks until element is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param source - Key of the source list to pop from
|
||||
* @param destination - Key of the destination list to push to
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument, timeout: number) {
|
||||
parser.push('BRPOPLPUSH');
|
||||
parser.pushKeys([source, destination]);
|
||||
|
@@ -4,6 +4,12 @@ import ZMPOP, { parseZMPopArguments, ZMPopArguments } from './ZMPOP';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Removes and returns members from one or more sorted sets in the specified order; blocks until elements are available
|
||||
* @param parser - The Redis command parser
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
* @param args - Additional arguments specifying the keys, min/max count, and order (MIN/MAX)
|
||||
*/
|
||||
parseCommand(parser: CommandParser, timeout: number, ...args: ZMPopArguments) {
|
||||
parser.push('BZMPOP', timeout.toString());
|
||||
parseZMPopArguments(parser, ...args);
|
||||
|
@@ -4,6 +4,12 @@ import { RedisVariadicArgument, transformDoubleReply } from './generic-transform
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Removes and returns the member with the highest score in a sorted set, or blocks until one is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param keys - Key of the sorted set, or array of keys to try sequentially
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(parser: CommandParser, keys: RedisVariadicArgument, timeout: number) {
|
||||
parser.push('BZPOPMAX');
|
||||
parser.pushKeys(keys);
|
||||
|
@@ -5,6 +5,12 @@ import BZPOPMAX from './BZPOPMAX';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: BZPOPMAX.IS_READ_ONLY,
|
||||
/**
|
||||
* Removes and returns the member with the lowest score in a sorted set, or blocks until one is available
|
||||
* @param parser - The Redis command parser
|
||||
* @param keys - Key of the sorted set, or array of keys to try sequentially
|
||||
* @param timeout - Maximum seconds to block, 0 to block indefinitely
|
||||
*/
|
||||
parseCommand(parser: CommandParser, keys: RedisVariadicArgument, timeout: number) {
|
||||
parser.push('BZPOPMIN');
|
||||
parser.pushKeys(keys);
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Instructs the server about tracking or not keys in the next request
|
||||
* @param parser - The Redis command parser
|
||||
* @param value - Whether to enable (true) or disable (false) tracking
|
||||
*/
|
||||
parseCommand(parser: CommandParser, value: boolean) {
|
||||
parser.push(
|
||||
'CLIENT',
|
||||
|
@@ -4,6 +4,10 @@ import { BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the name of the current connection
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'GETNAME');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the ID of the client to which the current client is redirecting tracking notifications
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'GETREDIR');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the client ID for the current connection
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'ID');
|
||||
},
|
||||
|
@@ -67,6 +67,10 @@ const CLIENT_INFO_REGEX = /([^\s=]+)=([^\s]*)/g;
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information and statistics about the current client connection
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'INFO');
|
||||
},
|
||||
|
@@ -50,6 +50,11 @@ export type ClientKillFilter = ClientKillAddress | ClientKillLocalAddress | Clie
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Closes client connections matching the specified filters
|
||||
* @param parser - The Redis command parser
|
||||
* @param filters - One or more filters to match client connections to kill
|
||||
*/
|
||||
parseCommand(parser: CommandParser, filters: ClientKillFilter | Array<ClientKillFilter>) {
|
||||
parser.push('CLIENT', 'KILL');
|
||||
|
||||
|
@@ -17,6 +17,11 @@ export type ListFilter = ListFilterType | ListFilterId;
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information about all client connections. Can be filtered by type or ID
|
||||
* @param parser - The Redis command parser
|
||||
* @param filter - Optional filter to return only specific client types or IDs
|
||||
*/
|
||||
parseCommand(parser: CommandParser, filter?: ListFilter) {
|
||||
parser.push('CLIENT', 'LIST');
|
||||
if (filter) {
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Controls whether to prevent the client's connections from being evicted
|
||||
* @param parser - The Redis command parser
|
||||
* @param value - Whether to enable (true) or disable (false) the no-evict mode
|
||||
*/
|
||||
parseCommand(parser: CommandParser, value: boolean) {
|
||||
parser.push(
|
||||
'CLIENT',
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Controls whether to prevent the client from touching the LRU/LFU of keys
|
||||
* @param parser - The Redis command parser
|
||||
* @param value - Whether to enable (true) or disable (false) the no-touch mode
|
||||
*/
|
||||
parseCommand(parser: CommandParser, value: boolean) {
|
||||
parser.push(
|
||||
'CLIENT',
|
||||
|
@@ -4,6 +4,12 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Stops the server from processing client commands for the specified duration
|
||||
* @param parser - The Redis command parser
|
||||
* @param timeout - Time in milliseconds to pause command processing
|
||||
* @param mode - Optional mode: 'WRITE' to pause only write commands, 'ALL' to pause all commands
|
||||
*/
|
||||
parseCommand(parser: CommandParser, timeout: number, mode?: 'WRITE' | 'ALL') {
|
||||
parser.push('CLIENT', 'PAUSE', timeout.toString());
|
||||
if (mode) {
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Assigns a name to the current connection
|
||||
* @param parser - The Redis command parser
|
||||
* @param name - The name to assign to the connection
|
||||
*/
|
||||
parseCommand(parser: CommandParser, name: RedisArgument) {
|
||||
parser.push('CLIENT', 'SETNAME', name);
|
||||
},
|
||||
|
@@ -29,6 +29,12 @@ export type ClientTrackingOptions = CommonOptions & (
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Controls server-assisted client side caching for the current connection
|
||||
* @param parser - The Redis command parser
|
||||
* @param mode - Whether to enable (true) or disable (false) tracking
|
||||
* @param options - Optional configuration including REDIRECT, BCAST, PREFIX, OPTIN, OPTOUT, and NOLOOP options
|
||||
*/
|
||||
parseCommand<M extends boolean>(
|
||||
parser: CommandParser,
|
||||
mode: M,
|
||||
|
@@ -10,6 +10,10 @@ type TrackingInfo = TuplesToMapReply<[
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information about the current connection's key tracking state
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'TRACKINGINFO');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Resumes processing of client commands after a CLIENT PAUSE
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLIENT', 'UNPAUSE');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Assigns hash slots to the current node in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param slots - One or more hash slots to be assigned
|
||||
*/
|
||||
parseCommand(parser: CommandParser, slots: number | Array<number>) {
|
||||
parser.push('CLUSTER', 'ADDSLOTS');
|
||||
parser.pushVariadicNumber(slots);
|
||||
|
@@ -5,6 +5,11 @@ import { parseSlotRangesArguments, SlotRange } from './generic-transformers';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Assigns hash slot ranges to the current node in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param ranges - One or more slot ranges to be assigned, each specified as [start, end]
|
||||
*/
|
||||
parseCommand(parser: CommandParser, ranges: SlotRange | Array<SlotRange>) {
|
||||
parser.push('CLUSTER', 'ADDSLOTSRANGE');
|
||||
parseSlotRangesArguments(parser, ranges);
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Advances the cluster config epoch
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'BUMPEPOCH');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the number of failure reports for a given node
|
||||
* @param parser - The Redis command parser
|
||||
* @param nodeId - The ID of the node to check
|
||||
*/
|
||||
parseCommand(parser: CommandParser, nodeId: RedisArgument) {
|
||||
parser.push('CLUSTER', 'COUNT-FAILURE-REPORTS', nodeId);
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the number of keys in the specified hash slot
|
||||
* @param parser - The Redis command parser
|
||||
* @param slot - The hash slot to check
|
||||
*/
|
||||
parseCommand(parser: CommandParser, slot: number) {
|
||||
parser.push('CLUSTER', 'COUNTKEYSINSLOT', slot.toString());
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Removes hash slots from the current node in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param slots - One or more hash slots to be removed
|
||||
*/
|
||||
parseCommand(parser: CommandParser, slots: number | Array<number>) {
|
||||
parser.push('CLUSTER', 'DELSLOTS');
|
||||
parser.pushVariadicNumber(slots);
|
||||
|
@@ -5,6 +5,11 @@ import { parseSlotRangesArguments, SlotRange } from './generic-transformers';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Removes hash slot ranges from the current node in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param ranges - One or more slot ranges to be removed, each specified as [start, end]
|
||||
*/
|
||||
parseCommand(parser:CommandParser, ranges: SlotRange | Array<SlotRange>) {
|
||||
parser.push('CLUSTER', 'DELSLOTSRANGE');
|
||||
parseSlotRangesArguments(parser, ranges);
|
||||
|
@@ -15,6 +15,11 @@ export interface ClusterFailoverOptions {
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Forces a replica to perform a manual failover of its master
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Optional configuration with FORCE or TAKEOVER mode
|
||||
*/
|
||||
parseCommand(parser:CommandParser, options?: ClusterFailoverOptions) {
|
||||
parser.push('CLUSTER', 'FAILOVER');
|
||||
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Deletes all hash slots from the current node in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'FLUSHSLOTS');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Removes a node from the cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param nodeId - The ID of the node to remove
|
||||
*/
|
||||
parseCommand(parser: CommandParser, nodeId: RedisArgument) {
|
||||
parser.push('CLUSTER', 'FORGET', nodeId);
|
||||
},
|
||||
|
@@ -4,6 +4,12 @@ import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns a number of keys from the specified hash slot
|
||||
* @param parser - The Redis command parser
|
||||
* @param slot - The hash slot to get keys from
|
||||
* @param count - Maximum number of keys to return
|
||||
*/
|
||||
parseCommand(parser: CommandParser, slot: number, count: number) {
|
||||
parser.push('CLUSTER', 'GETKEYSINSLOT', slot.toString(), count.toString());
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { VerbatimStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information about the state of a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'INFO');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { Command, NumberReply, RedisArgument } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the hash slot number for a given key
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - The key to get the hash slot for
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument) {
|
||||
parser.push('CLUSTER', 'KEYSLOT', key);
|
||||
},
|
||||
|
@@ -13,6 +13,10 @@ type ClusterLinksReply = ArrayReply<TuplesToMapReply<[
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information about all cluster links (lower level connections to other nodes)
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'LINKS');
|
||||
},
|
||||
|
@@ -4,6 +4,12 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Initiates a handshake with another node in the cluster
|
||||
* @param parser - The Redis command parser
|
||||
* @param host - Host name or IP address of the node
|
||||
* @param port - TCP port of the node
|
||||
*/
|
||||
parseCommand(parser: CommandParser, host: string, port: number) {
|
||||
parser.push('CLUSTER', 'MEET', host, port.toString());
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the node ID of the current Redis Cluster node
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'MYID');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the shard ID of the current Redis Cluster node
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'MYSHARDID');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { VerbatimStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns serialized information about the nodes in a Redis Cluster
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'NODES');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/typ
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the replica nodes replicating from the specified primary node
|
||||
* @param parser - The Redis command parser
|
||||
* @param nodeId - Node ID of the primary node
|
||||
*/
|
||||
parseCommand(parser: CommandParser, nodeId: RedisArgument) {
|
||||
parser.push('CLUSTER', 'REPLICAS', nodeId);
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Reconfigures a node as a replica of the specified primary node
|
||||
* @param parser - The Redis command parser
|
||||
* @param nodeId - Node ID of the primary node to replicate
|
||||
*/
|
||||
parseCommand(parser: CommandParser, nodeId: RedisArgument) {
|
||||
parser.push('CLUSTER', 'REPLICATE', nodeId);
|
||||
},
|
||||
|
@@ -8,6 +8,11 @@ export interface ClusterResetOptions {
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Resets a Redis Cluster node, clearing all information and returning it to a brand new state
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Options for the reset operation
|
||||
*/
|
||||
parseCommand(parser: CommandParser, options?: ClusterResetOptions) {
|
||||
parser.push('CLUSTER', 'RESET');
|
||||
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Forces a Redis Cluster node to save the cluster configuration to disk
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'SAVECONFIG');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Sets the configuration epoch for a Redis Cluster node
|
||||
* @param parser - The Redis command parser
|
||||
* @param configEpoch - The configuration epoch to set
|
||||
*/
|
||||
parseCommand(parser: CommandParser, configEpoch: number) {
|
||||
parser.push('CLUSTER', 'SET-CONFIG-EPOCH', configEpoch.toString());
|
||||
},
|
||||
|
@@ -13,6 +13,13 @@ export type ClusterSlotState = typeof CLUSTER_SLOT_STATES[keyof typeof CLUSTER_S
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Assigns a hash slot to a specific Redis Cluster node
|
||||
* @param parser - The Redis command parser
|
||||
* @param slot - The slot number to assign
|
||||
* @param state - The state to set for the slot (IMPORTING, MIGRATING, STABLE, NODE)
|
||||
* @param nodeId - Node ID (required for IMPORTING, MIGRATING, and NODE states)
|
||||
*/
|
||||
parseCommand(parser: CommandParser, slot: number, state: ClusterSlotState, nodeId?: RedisArgument) {
|
||||
parser.push('CLUSTER', 'SETSLOT', slot.toString(), state);
|
||||
|
||||
|
@@ -19,6 +19,10 @@ export type ClusterSlotsNode = ReturnType<typeof transformNode>;
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns information about which Redis Cluster node handles which hash slots
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CLUSTER', 'SLOTS');
|
||||
},
|
||||
|
@@ -5,6 +5,10 @@ import { CommandRawReply, CommandReply, transformCommandReply } from './generic-
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns an array with details about all Redis commands
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('COMMAND');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the total number of commands available in the Redis server
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('COMMAND', 'COUNT');
|
||||
},
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/typ
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Extracts the key names from a Redis command
|
||||
* @param parser - The Redis command parser
|
||||
* @param args - Command arguments to analyze
|
||||
*/
|
||||
parseCommand(parser: CommandParser, args: Array<RedisArgument>) {
|
||||
parser.push('COMMAND', 'GETKEYS');
|
||||
parser.push(...args);
|
||||
|
@@ -9,6 +9,11 @@ export type CommandGetKeysAndFlagsRawReply = ArrayReply<TuplesReply<[
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Extracts the key names and access flags from a Redis command
|
||||
* @param parser - The Redis command parser
|
||||
* @param args - Command arguments to analyze
|
||||
*/
|
||||
parseCommand(parser: CommandParser, args: Array<RedisArgument>) {
|
||||
parser.push('COMMAND', 'GETKEYSANDFLAGS');
|
||||
parser.push(...args);
|
||||
|
@@ -5,6 +5,11 @@ import { CommandRawReply, CommandReply, transformCommandReply } from './generic-
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns details about specific Redis commands
|
||||
* @param parser - The Redis command parser
|
||||
* @param commands - Array of command names to get information about
|
||||
*/
|
||||
parseCommand(parser: CommandParser, commands: Array<string>) {
|
||||
parser.push('COMMAND', 'INFO', ...commands);
|
||||
},
|
||||
|
@@ -19,6 +19,11 @@ export interface CommandListOptions {
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns a list of all commands supported by the Redis server
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Options for filtering the command list
|
||||
*/
|
||||
parseCommand(parser: CommandParser, options?: CommandListOptions) {
|
||||
parser.push('COMMAND', 'LIST');
|
||||
|
||||
|
@@ -5,6 +5,11 @@ import { RedisVariadicArgument, transformTuplesReply } from './generic-transform
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Gets the values of configuration parameters
|
||||
* @param parser - The Redis command parser
|
||||
* @param parameters - Pattern or specific configuration parameter names
|
||||
*/
|
||||
parseCommand(parser: CommandParser, parameters: RedisVariadicArgument) {
|
||||
parser.push('CONFIG', 'GET');
|
||||
parser.pushVariadic(parameters);
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Resets the statistics reported by Redis using the INFO command
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CONFIG', 'RESETSTAT');
|
||||
},
|
||||
|
@@ -4,6 +4,10 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Rewrites the Redis configuration file with the current configuration
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('CONFIG', 'REWRITE');
|
||||
},
|
||||
|
@@ -8,6 +8,12 @@ type MultipleParameters = [config: Record<string, RedisArgument>];
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Sets configuration parameters to the specified values
|
||||
* @param parser - The Redis command parser
|
||||
* @param parameterOrConfig - Either a single parameter name or a configuration object
|
||||
* @param value - Value for the parameter (when using single parameter format)
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
...[parameterOrConfig, value]: SingleParameter | MultipleParameters
|
||||
|
@@ -8,6 +8,13 @@ export interface CopyCommandOptions {
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Copies the value stored at the source key to the destination key
|
||||
* @param parser - The Redis command parser
|
||||
* @param source - Source key
|
||||
* @param destination - Destination key
|
||||
* @param options - Options for the copy operation
|
||||
*/
|
||||
parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument, options?: CopyCommandOptions) {
|
||||
parser.push('COPY');
|
||||
parser.pushKeys([source, destination]);
|
||||
|
@@ -4,6 +4,10 @@ import { NumberReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the number of keys in the current database
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('DBSIZE');
|
||||
},
|
||||
|
@@ -2,6 +2,11 @@ import { CommandParser } from '../client/parser';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Decrements the integer value of a key by one
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to decrement
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument) {
|
||||
parser.push('DECR');
|
||||
parser.pushKey(key);
|
||||
|
@@ -2,6 +2,12 @@ import { CommandParser } from '../client/parser';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Decrements the integer value of a key by the given number
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to decrement
|
||||
* @param decrement - Decrement amount
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument, decrement: number) {
|
||||
parser.push('DECRBY');
|
||||
parser.pushKey(key);
|
||||
|
@@ -4,6 +4,11 @@ import { RedisVariadicArgument } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Removes the specified keys. A key is ignored if it does not exist
|
||||
* @param parser - The Redis command parser
|
||||
* @param keys - One or more keys to delete
|
||||
*/
|
||||
parseCommand(parser: CommandParser, keys: RedisVariadicArgument) {
|
||||
parser.push('DEL');
|
||||
parser.pushKeys(keys);
|
||||
|
@@ -2,6 +2,10 @@ import { CommandParser } from '../client/parser';
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Discards a transaction, forgetting all queued commands
|
||||
* @param parser - The Redis command parser
|
||||
*/
|
||||
parseCommand(parser: CommandParser) {
|
||||
parser.push('DISCARD');
|
||||
},
|
||||
|
@@ -3,6 +3,11 @@ import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns a serialized version of the value stored at the key
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to dump
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument) {
|
||||
parser.push('DUMP');
|
||||
parser.pushKey(key);
|
||||
|
@@ -4,6 +4,11 @@ import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the given string
|
||||
* @param parser - The Redis command parser
|
||||
* @param message - Message to echo back
|
||||
*/
|
||||
parseCommand(parser: CommandParser, message: RedisArgument) {
|
||||
parser.push('ECHO', message);
|
||||
},
|
||||
|
@@ -25,6 +25,12 @@ export function parseEvalArguments(
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Executes a Lua script server side
|
||||
* @param parser - The Redis command parser
|
||||
* @param script - Lua script to execute
|
||||
* @param options - Script execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('EVAL');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -3,6 +3,12 @@ import EVAL, { parseEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Executes a Lua script server side using the script's SHA1 digest
|
||||
* @param parser - The Redis command parser
|
||||
* @param sha1 - SHA1 digest of the script
|
||||
* @param options - Script execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('EVALSHA');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -3,6 +3,12 @@ import EVAL, { parseEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Executes a read-only Lua script server side using the script's SHA1 digest
|
||||
* @param parser - The Redis command parser
|
||||
* @param sha1 - SHA1 digest of the script
|
||||
* @param options - Script execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('EVALSHA_RO');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -3,6 +3,12 @@ import EVAL, { parseEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Executes a read-only Lua script server side
|
||||
* @param parser - The Redis command parser
|
||||
* @param script - Lua script to execute
|
||||
* @param options - Script execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('EVAL_RO');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -5,6 +5,11 @@ import { RedisVariadicArgument } from './generic-transformers';
|
||||
export default {
|
||||
CACHEABLE: true,
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Determines if the specified keys exist
|
||||
* @param parser - The Redis command parser
|
||||
* @param keys - One or more keys to check
|
||||
*/
|
||||
parseCommand(parser: CommandParser, keys: RedisVariadicArgument) {
|
||||
parser.push('EXISTS');
|
||||
parser.pushKeys(keys);
|
||||
|
@@ -3,6 +3,13 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Sets a timeout on key. After the timeout has expired, the key will be automatically deleted
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to set expiration on
|
||||
* @param seconds - Number of seconds until key expiration
|
||||
* @param mode - Expiration mode: NX (only if key has no expiry), XX (only if key has existing expiry), GT (only if new expiry is greater than current), LT (only if new expiry is less than current)
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
key: RedisArgument,
|
||||
|
@@ -4,6 +4,13 @@ import { transformEXAT } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Sets the expiration for a key at a specific Unix timestamp
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to set expiration on
|
||||
* @param timestamp - Unix timestamp (seconds since January 1, 1970) or Date object
|
||||
* @param mode - Expiration mode: NX (only if key has no expiry), XX (only if key has existing expiry), GT (only if new expiry is greater than current), LT (only if new expiry is less than current)
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
key: RedisArgument,
|
||||
|
@@ -3,6 +3,11 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
/**
|
||||
* Returns the absolute Unix timestamp (since January 1, 1970) at which the given key will expire
|
||||
* @param parser - The Redis command parser
|
||||
* @param key - Key to check expiration time
|
||||
*/
|
||||
parseCommand(parser: CommandParser, key: RedisArgument) {
|
||||
parser.push('EXPIRETIME');
|
||||
parser.pushKey(key);
|
||||
|
@@ -12,6 +12,11 @@ interface FailoverOptions {
|
||||
}
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Starts a coordinated failover between the primary and a replica
|
||||
* @param parser - The Redis command parser
|
||||
* @param options - Failover options including target host, abort flag, and timeout
|
||||
*/
|
||||
parseCommand(parser: CommandParser, options?: FailoverOptions) {
|
||||
parser.push('FAILOVER');
|
||||
|
||||
|
@@ -3,6 +3,12 @@ import EVAL, { parseEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Invokes a Redis function
|
||||
* @param parser - The Redis command parser
|
||||
* @param functionName - Name of the function to call
|
||||
* @param options - Function execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('FCALL');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -3,6 +3,12 @@ import EVAL, { parseEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Invokes a read-only Redis function
|
||||
* @param parser - The Redis command parser
|
||||
* @param functionName - Name of the function to call
|
||||
* @param options - Function execution options including keys and arguments
|
||||
*/
|
||||
parseCommand(...args: Parameters<typeof parseEvalArguments>) {
|
||||
args[0].push('FCALL_RO');
|
||||
parseEvalArguments(...args);
|
||||
|
@@ -11,6 +11,11 @@ export type RedisFlushMode = typeof REDIS_FLUSH_MODES[keyof typeof REDIS_FLUSH_M
|
||||
export default {
|
||||
NOT_KEYED_COMMAND: true,
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Removes all keys from all databases
|
||||
* @param parser - The Redis command parser
|
||||
* @param mode - Optional flush mode (ASYNC or SYNC)
|
||||
*/
|
||||
parseCommand(parser: CommandParser, mode?: RedisFlushMode) {
|
||||
parser.push('FLUSHALL');
|
||||
if (mode) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user