XADD
Appends a new message to a stream. Creates the key if it doesn’t exist.
Browse all commands · Upstream source documentation
| Reference field | Value |
|---|---|
| Canonical name | XADD |
| Catalog group | Stream commands |
| Upstream since | 5.0.0 — upstream Redis/module version, not an ffkv release |
| Pinned catalog | Redis 8.10.0 |
Syntax
Section titled “Syntax”XADD key [NOMKSTREAM] [KEEPREF | DELREF | ACKED] [IDMPAUTO producer-id | IDMP producer-id idempotent-id] [<MAXLEN | MINID> [= | ~] threshold [LIMIT count]] <* | id> field value [field value ...]ffkv behavior and limits
Section titled “ffkv behavior and limits”Stream waits are bounded to 65,536 clients and 64 MiB of retained logical requests (also limited by the connection cap). Approximate MAXLEN trimming uses 100-entry granularity. EXEC/Lua reads never block. Physical index statistics describe ffkv, not Redis allocator internals.
Source: README.md:351–374; tests/bdd/features/streams.feature.
All requests share the 8 MiB framing/1,024-argument ingress limit; normal RESP replies have 64 MiB wire/logical budgets with bounded nesting/value counts. Management and Lua origins impose smaller budgets. These are not a process RSS cap. Catalog inclusion is not exhaustive option or wire-format parity. See limits and compatibility.
Upstream metadata
Section titled “Upstream metadata”The following fields come from the pinned Redis metadata, not measured ffkv performance or an assertion that ffkv enforces every upstream flag. Running COMMAND INFO/COMMAND DOCS describe the current engine.
Upstream Redis complexity: O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted.
Upstream arity: -5 (includes the command name; a negative number is a minimum).
Command flags: WRITE, DENYOOM, FAST.
ACL categories: STREAM.
Command tips: NONDETERMINISTIC_OUTPUT.
Argument structure
Section titled “Argument structure”| Argument | Type | Constraints / metadata |
|---|---|---|
key | key | key_spec_index: 0 |
nomkstream | pure-token | optional; token: NOMKSTREAM; since: 6.2.0 |
condition | oneof | optional |
↳ keepref | pure-token | token: KEEPREF |
↳ delref | pure-token | token: DELREF |
↳ acked | pure-token | token: ACKED |
idmp | oneof | optional; since: 8.6.0 |
↳ pid | string | token: IDMPAUTO |
↳ idmp | block | token: IDMP |
↳ ↳ pid | string | Required |
↳ ↳ iid | string | Required |
trim | block | optional |
↳ strategy | oneof | Required |
↳ ↳ maxlen | pure-token | token: MAXLEN |
↳ ↳ minid | pure-token | token: MINID; since: 6.2.0 |
↳ operator | oneof | optional |
↳ ↳ equal | pure-token | token: = |
↳ ↳ approximately | pure-token | token: ~ |
↳ threshold | string | Required |
↳ count | integer | optional; token: LIMIT; since: 6.2.0 |
id-selector | oneof | Required |
↳ auto-id | pure-token | token: * |
↳ id | string | Required |
data | block | multiple |
↳ field | string | Required |
↳ value | string | Required |
Key specifications
Section titled “Key specifications”Upstream key discovery descriptors (indexes are relative to the full command vector):
[ { "notes": "UPDATE instead of INSERT because of the optional trimming feature", "flags": [ "RW", "UPDATE" ], "begin_search": { "index": { "pos": 1 } }, "find_keys": { "range": { "lastkey": 0, "step": 1, "limit": 0 } } }]Additional pinned upstream metadata
{ "group": "stream", "since": "5.0.0", "history": [ [ "6.2.0", "Added the `NOMKSTREAM` option, `MINID` trimming strategy and the `LIMIT` option." ], [ "7.0.0", "Added support for the `<ms>-*` explicit ID form." ], [ "8.2.0", "Added the `KEEPREF`, `DELREF` and `ACKED` options." ] ]}Metadata source · Local snapshot: src/command_metadata.json, key xadd.
BDD coverage and source examples
Section titled “BDD coverage and source examples”These are source observations, not a test run performed by this documentation build. A tag identifies scenario intent; an extracted vector identifies a command invocation, which may intentionally produce an error. Scenarios may require setup, multiple connections, persistence, cluster nodes or native-module fixtures.
- Explicit IDs preserve duplicate field ordering and range direction —
tests/bdd/features/streams.feature:5; command tag and invocation observed. - A blocked read wakes with only entries newer than its requested ID —
tests/bdd/features/streams.feature:94; invocation observed. - Groups create consumers deliver pending work and acknowledge ownership durably —
tests/bdd/features/streams.feature:126; invocation observed. - Claim and autoclaim transfer ownership and preserve message payload —
tests/bdd/features/streams.feature:223; invocation observed. - NACK releases owned work and makes it immediately claimable —
tests/bdd/features/streams.feature:262; invocation observed. - Group cursor reset redelivers history while consumer and group removal clear metadata —
tests/bdd/features/streams.feature:301; invocation observed. - ACKED deletion waits for all group acknowledgements and DELREF clears references —
tests/bdd/features/streams.feature:373; invocation observed. - Replicated stream IDs govern subsequent insertion and expose counters —
tests/bdd/features/streams.feature:452; invocation observed. - Idempotency replay retains original payload and configuration reset permits a fresh append —
tests/bdd/features/streams.feature:497; invocation observed. - ACKED trimming skips pending entries rather than stopping at them (Scenario Outline) —
tests/bdd/features/streams.feature:620; invocation observed. - Repeated reference policies reject the whole command without deleting entries or pending ownership (Scenario Outline) —
tests/bdd/features/streams.feature:674; command tag and invocation observed. - FORCE counts both creation and claim unless JUSTID or RETRYCOUNT changes the count (Scenario Outline) —
tests/bdd/features/streams.feature:752; invocation observed.
Extracted command vectors
Section titled “Extracted command vectors”The following JSON arrays are the test harness’s argument vectors, not shell commands. Numeric arguments are converted by the harness; objects of the form {"base64":"…"} represent decoded binary bytes, not a literal JSON command argument. Preserve scenario setup and connection ordering. See the CLI guide for shell quoting and binary stdin. No reply is invented or inferred.
Explicit IDs preserve duplicate field ordering and range direction — tests/bdd/features/streams.feature:15 (I execute:)
[ "XADD", "events", "1001-0", "field", "c"]Next source assertion: the reply equals:
"1001-0"Replicated stream IDs govern subsequent insertion and expose counters — tests/bdd/features/streams.feature:480 (I execute:)
[ "XADD", "events", "2000-1", "field", "next"]Next source assertion: the reply equals:
"2000-1"Idempotency replay retains original payload and configuration reset permits a fresh append — tests/bdd/features/streams.feature:565 (I execute:)
[ "XADD", "events", "IDMP", "producer", "order-1", "*", "field", "after-recovery"]Next source assertion: the reply equals:
"1000-0"