You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Add Redis 8.2 New Stream Commands (#3029)
* chore: update Redis version from 8.2-RC1-pre to 8.2-rc1 * feat: implement XDELEX command for Redis 8.2 * feat: implement XACKDEL command for Redis 8.2 * refactor: create shared stream deletion types for Redis 8.2 commands * feat: add Redis 8.2 deletion policies to XTRIM command * feat: add Redis 8.2 deletion policies to XADD commands * fix: correct XDELEX command method name and test parameter
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { CommandParser } from '../client/parser';
|
||||
import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
|
||||
import { StreamDeletionPolicy } from './common-stream.types';
|
||||
import { Tail } from './generic-transformers';
|
||||
|
||||
/**
|
||||
@@ -10,6 +11,7 @@ import { Tail } from './generic-transformers';
|
||||
* @property TRIM.strategyModifier - Exact ('=') or approximate ('~') trimming
|
||||
* @property TRIM.threshold - Maximum stream length or minimum ID to retain
|
||||
* @property TRIM.limit - Maximum number of entries to trim in one call
|
||||
* @property TRIM.policy - Policy to apply when trimming entries (optional, defaults to KEEPREF)
|
||||
*/
|
||||
export interface XAddOptions {
|
||||
TRIM?: {
|
||||
@@ -17,6 +19,8 @@ export interface XAddOptions {
|
||||
strategyModifier?: '=' | '~';
|
||||
threshold: number;
|
||||
limit?: number;
|
||||
/** added in 8.2 */
|
||||
policy?: StreamDeletionPolicy;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,6 +62,10 @@ export function parseXAddArguments(
|
||||
if (options.TRIM.limit) {
|
||||
parser.push('LIMIT', options.TRIM.limit.toString());
|
||||
}
|
||||
|
||||
if (options.TRIM.policy) {
|
||||
parser.push(options.TRIM.policy);
|
||||
}
|
||||
}
|
||||
|
||||
parser.push(id);
|
||||
|
Reference in New Issue
Block a user