Trying to remove the completed redis stream events after particular time interval. Currently, we can remove the redis stream events after particular time interval using XTRIM command , but it will remove all stream events even when it is pending. I want to remove the redis stream events based on the status[completed or pending].
is there any other ways to check the remove the redis events based on the status of redis stream ?
You can use
XDELto remove individual entries once you are sure all consumers that might want the data have consumed it, or that the data isn't relevant to your application any more. You will need logic to determine what "can be deleted" means for your application, as that's very domain specific.Other than that, your options are to trim by time/minimum ID or overall stream length using either or both of the
XADDandXTRIMcommands.XDELdocs: https://redis.io/commands/xdel/