gpt4 book ai didi

redis - 从Redis流中删除一系列条目

转载 作者:行者123 更新时间:2023-12-03 06:44:51 24 4
gpt4 key购买 nike

我想删除比特定条目ID更早的Redis Stream条目。但是XDEL命令将每个ID明确地作为输入。有什么方法可以指定一个ID范围,当流中有很多条目时,这些范围会有所帮助?另外,修剪一系列条目也将有助于我重新收集未存储的内存。

最佳答案

目前没有办法。

However, XTRIM is designed to accept different trimming strategies, even if currently only MAXLEN is implemented. Given that this is an explicit command, it is possible that in the future it will allow to specify trimming by time, because the user calling this command in a stand-alone way is supposed to know what she or he is doing.

One useful eviction strategy that XTRIM should have is probably the ability to remove by a range of IDs. This is currently not possible, but will be likely implemented in the future in order to more easily use XRANGE and XTRIM together to move data from Redis to other storage systems if needed.



您可以使用XTRIM声明空间,在XTRIM中可以指定所需的长度。
XTRIM mystream MAXLEN ~ 1000
在这1000个中,剩余流的大小可以或多或少,大约是一个数字。

引用: https://redis.io/topics/streams-intro

关于redis - 从Redis流中删除一系列条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62274878/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com