redis.xadd(key, "*", { name: "John Doe", age: 30 })

Arguments

key
str
required

The key to of the stream.

id
str | *
required

The stream entry ID. If * is passed, a new ID will be generated automatically.

entries
Record<str, unknown>
required

Key-value data to be appended to the stream.

options
nomkStream
boolean

Prevent creating the stream if it does not exist.

trim
type
'MAXLEN' | 'MINID'
required

The trim mode.

threshold
number | str
required

The threshold value for the trim mode.

comparison
~ | =
required

The comparison operator for the trim mode.

limit
number

Limit how many entries will be trimmed at most.

Response

The ID of the newly added entry.

Was this page helpful?