You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How about modify the limit of the maxlen parameter that can be passed when using the xadd command?
Some users may want to create an empty stream with xadd.
While using stream, I also felt the need to empty the contents of the stream once.
Since xadd's maxlendid not allow 0 at the time,
I solved the problem using execute_command,
importredisr=redis.Redis(host='localhost', port=6379, db=0)
# not working# r.xadd("my-stream", {"hello": "world"}, maxlen=0)# it worksr.execute_command("XADD", "my-stream", "MAXLEN", "0", "*", "data", "{}")
execute_command is preety good.
but someone might want to implement these logic with XADD.
redis 5.0 and unstable version as well
Since stream was added, it accepts integers up to and including 0.
Version:
Platform: Python 3.10.4 on macOS 12.2.1
Description:
r/ #2739
How about modify the limit of the maxlen parameter that can be passed when using the xadd command?
Some users may want to create an empty stream with xadd.
While using stream, I also felt the need to empty the contents of the stream once.
Since xadd's
maxlen
did not allow 0 at the time,I solved the problem using
execute_command
,execute_command
is preety good.but someone might want to implement these logic with
XADD
.redis 5.0 and unstable version as well
Since stream was added, it accepts integers up to and including 0.
from redis/redis
5.0
branchhttps://github.com/redis/redis/blob/05827336b0efcb454bcc5fe77ceacc6f226b6bb2/src/t_stream.c#L1269
from redis/redis
unstable
branchhttps://github.com/redis/redis/blob/5e3be1be09c947810732e7be2a4bb1b0ed75de4a/src/t_stream.c#LL941C30-L941C30
So, I suggest changing the
MAXLEN
of theXADD
command to allow a positive number including 0.AS-IS:
TO-BE:
The text was updated successfully, but these errors were encountered: