class Redis

def xtrim(key, maxlen, approximate: false)

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

Parameters:
  • approximate (Boolean) -- whether to add `~` modifier of maxlen or not
  • mexlen (Integer) -- max length of entries
  • key (String) -- the stream key

Other tags:
    Example: With options -
    Example: Without options -
def xtrim(key, maxlen, approximate: false)
  args = [:xtrim, key, 'MAXLEN', (approximate ? '~' : nil), maxlen].compact
  synchronize { |client| client.call(args) }
end