You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +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,16 +1,20 @@
|
||||
import { CommandParser } from '../client/parser';
|
||||
import { NumberReply, Command, RedisArgument } from '../RESP/types';
|
||||
import { StreamDeletionPolicy } from './common-stream.types';
|
||||
|
||||
/**
|
||||
* Options for the XTRIM command
|
||||
*
|
||||
* @property strategyModifier - Exact ('=') or approximate ('~') trimming
|
||||
* @property LIMIT - Maximum number of entries to trim in one call (Redis 6.2+)
|
||||
* @property policy - Policy to apply when deleting entries (optional, defaults to KEEPREF)
|
||||
*/
|
||||
export interface XTrimOptions {
|
||||
strategyModifier?: '=' | '~';
|
||||
/** added in 6.2 */
|
||||
LIMIT?: number;
|
||||
/** added in 8.2 */
|
||||
policy?: StreamDeletionPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +53,10 @@ export default {
|
||||
if (options?.LIMIT) {
|
||||
parser.push('LIMIT', options.LIMIT.toString());
|
||||
}
|
||||
|
||||
if (options?.policy) {
|
||||
parser.push(options.policy);
|
||||
}
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user