Skip to main content

Arguments

key
str
required
The key of the stream.
maxlen
int
The maximum number of entries to keep in the stream. Mutually exclusive with minid.
approximate
bool
default:"True"
Use approximate trimming (more efficient). When True, Redis may keep slightly more entries than specified. Defaults to True.
minid
str
The minimum ID to keep. Entries with IDs lower than this will be removed. Mutually exclusive with maxlen.
limit
int
Limit how many entries will be trimmed at most.

Response

The number of entries removed from the stream.
result = redis.xtrim("mystream", maxlen=50)
I