Upstash Documentation

XTRIM

Trims the stream by removing entries to keep it at a reasonable size.
1 min read

Arguments#

keystringrequired#

The key of the stream.

optionsobjectrequired#
Show properties
strategy'MAXLEN' | 'MINID'required#

The trimming strategy:

  • MAXLEN: Trim based on the maximum number of entries
  • MINID: Trim based on the minimum ID
thresholdnumber | stringrequired#

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
exactness'~' | '='#

Use ~ for approximate trimming (more efficient, default) or = for exact trimming.

limitnumber#

Limit how many entries will be trimmed at most (only valid with approximate trimming ~).

Response#