1

I am new to redis streams, I have googled a lot, but I still cannot figure this question out: How do I delete an entire stream in redis? I don't need that stream anymore, I want to delete it to release memories and storagies, I wonder if I have to use xdel command to delete all entries in the stream?

Jack Zhou
  • 163
  • 7

1 Answers1

1

As @for_stack has suggested in the comments, you can use the DEL command to delete a stream, as you would do with any other key in Redis:

> DEL mystream
OK

The XDEL command removes the given entry/ies from the stream but not the stream itself:

> XDEL mystream 1538561700640-0 1538561700655-0
(integer) 2

Similarly, the XTRIM command can be used to remove older entries from a stream but does not delete the stream itself:

> XTRIM mystream MINID 649085820
(integer) 42
Efran Cobisi
  • 6,138
  • 22
  • 22