Stream
XTRIM
Trims the stream by removing entries to keep it at a reasonable size.
Arguments
keybodystringrequired
The key of the stream.
optionsbodyobjectrequired
Response
number
The number of entries removed from the stream.
Approximate trim by max length
const result = await redis.xtrim("mystream", { strategy: "MAXLEN", threshold: 100, exactness: "~"});Exact trim by max length
const result = await redis.xtrim("mystream", { strategy: "MAXLEN", threshold: 50, exactness: "="});Trim by minimum ID
const result = await redis.xtrim("mystream", { strategy: "MINID", threshold: "1638360173533-0", exactness: "="});Approximate trim with limit
const result = await redis.xtrim("mystream", { strategy: "MAXLEN", threshold: 1000, exactness: "~", limit: 100});