Skip to main content

The XDELEX command provides extended deletion capabilities for stream entries with additional control options. This is an enhanced version of XDEL with more advanced features for managing stream data.

Arguments#

keystringrequired#

The key of the stream.

option'KEEPREF' | 'keepref' | 'DELREF' | 'delref' | 'ACKED' | 'acked'#

Optional deletion behavior (case-insensitive). When provided, must come before the IDs:

  • KEEPREF: Delete the entries but keep their references in other consumer groups’ pending lists
  • DELREF: Delete the entries and remove their references from every consumer group’s pending list
  • ACKED: Only delete entries that every consumer group has acknowledged

Pass undefined to use the server default (KEEPREF).

ids...string[]required#

One or more stream entry IDs to delete. When an option is provided, IDs must come after the option.

Response#

number[]required

An array of numbers indicating the result for each ID in the same order as provided.

Use Cases#

  • Stream Cleanup: Remove processed or expired stream entries
  • Data Retention: Implement custom retention policies
  • Error Handling: Delete corrupted or invalid stream entries
  • Memory Management: Clean up streams to free memory
Note

This command is available in Redis 8.2.0 and later. It provides extended functionality compared to the standard XDEL command.