module Redis::Commands::Streams

def xtrim(key, len_or_id, strategy: 'MAXLEN', approximate: false, limit: nil)

Returns:
  • (Integer) - the number of entries actually deleted

Parameters:
  • limit (Integer) -- maximum count of entries to be evicted
  • approximate (Boolean) -- whether to add `~` modifier of minid or not
  • strategy (String) -- the limit strategy, must be MINID
  • minid (String) -- minimum id of entries
  • key (String) -- the stream key
  • limit (Integer) -- maximum count of entries to be evicted
  • approximate (Boolean) -- whether to add `~` modifier of maxlen or not
  • strategy (String) -- the limit strategy, must be MAXLEN
  • maxlen (Integer) -- max length of entries
  • key (String) -- the stream key

Overloads:
  • xtrim(key, minid, strategy: 'MINID', approximate: true)
  • xtrim(key, maxlen, strategy: 'MAXLEN', approximate: true)

Other tags:
    Example: With strategy -
    Example: With options -
    Example: Without options -
def xtrim(key, len_or_id, strategy: 'MAXLEN', approximate: false, limit: nil)
  strategy = strategy.to_s.upcase
  args = [:xtrim, key, strategy]
  args << '~' if approximate
  args << len_or_id
  args.concat(['LIMIT', limit]) if limit
  send_command(args)
end