Skip to main content

Arguments

key
string
required
The key of the stream.
options
object
required

Response

The number of entries removed from the stream.
const result = await redis.xtrim("mystream", {
  strategy: "MAXLEN",
  threshold: 100,
  exactness: "~"
});
const result = await redis.xtrim("mystream", {
  strategy: "MAXLEN", 
  threshold: 50,
  exactness: "="
});
const result = await redis.xtrim("mystream", {
  strategy: "MINID",
  threshold: "1638360173533-0",
  exactness: "="
});
const result = await redis.xtrim("mystream", {
  strategy: "MAXLEN",
  threshold: 1000,
  exactness: "~",
  limit: 100
});