Arguments
strategy
'MAXLEN' | 'MINID'
required
The trimming strategy:
MAXLEN: Trim based on the maximum number of entries
MINID: Trim based on the minimum ID
The threshold value for trimming:
- For
MAXLEN: The maximum number of entries to keep (number)
- For
MINID: The minimum ID to keep (string). Entries with IDs lower than this will be removed
Use ~ for approximate trimming (more efficient, default) or = for exact trimming.
Limit how many entries will be trimmed at most (only valid with approximate trimming ~).
Response
The number of entries removed from the stream.
const result = await redis.xtrim("mystream", {
strategy: "MAXLEN",
threshold: 100,
exactness: "~"
});