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

key
string
required
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: Keep consumer group references
  • DELREF: Delete consumer group references
  • ACKED: Only acknowledge messages (don’t delete)
If not provided, entries are deleted by default.
ids
...string[]
required
One or more stream entry IDs to delete. When an option is provided, IDs must come after the option.

Response

An array of numbers indicating the result for each ID in the same order as provided.
// Delete a single stream entry
const result = await redis.xdelex("mystream", "1638360173533-0");
console.log(result); // Array of results for each ID

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
This command is available in Redis 8.2.0 and later. It provides extended functionality compared to the standard XDEL command.