Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

XCFGSET

Last updated
XCFGSET key [IDMP-DURATION seconds] [IDMP-MAXSIZE entries]
Group
Stream
Arity
-2 (at least 2 words, counting the command name)
Flags
write, fast
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

XCFGSET sets the two limits that govern idempotent production on an existing stream: how many seconds a stream keeps each idempotent ID that a producer added entries with (IDMP-DURATION), and how many IDs it keeps for each producer (IDMP-MAXSIZE). A producer that adds an entry again with an ID the stream still remembers adds nothing, so these limits decide how long a retry is safe. At least one option is required.

Setting a value different from the stream’s current one makes the stream forget the IDs it holds. Setting the values it already has changes nothing, so several publishers can each set the same limits before they publish.

Option Effect
IDMP-DURATION seconds How long an idempotent ID is kept, from 1 to 86400 seconds.
IDMP-MAXSIZE entries How many idempotent IDs are kept for each producer, from 1 to 10000.

Simple string OK in RESP2 and RESP3. XINFO STREAM shows the values as idmp-duration and idmp-maxsize. Errors:

Error Cause
ERR no such key The stream does not exist.
WRONGTYPE Operation against a key holding the wrong kind of value The key holds another type.
ERR IDMP-DURATION must be between 1 and 86400 seconds The duration is out of range.
ERR IDMP-MAXSIZE must be between 1 and 10000 entries The size is out of range.
ERR IDMP-DURATION specified multiple times, ERR IDMP-MAXSIZE specified multiple times An option is given twice.
ERR value is not an integer or out of range A value is not a number.
ERR At least one parameter must be specified No option given.
ERR syntax error An unknown option, or an option with no value after it.
127.0.0.1:6379> XADD events * type signup
"1791069526348-0"
127.0.0.1:6379> XCFGSET events IDMP-DURATION 100 IDMP-MAXSIZE 50
OK
127.0.0.1:6379> XCFGSET events IDMP-DURATION 100 IDMP-MAXSIZE 50
OK
127.0.0.1:6379> XCFGSET nostream IDMP-DURATION 100
(error) ERR no such key
127.0.0.1:6379> XCFGSET events IDMP-DURATION 0
(error) ERR IDMP-DURATION must be between 1 and 86400 seconds
127.0.0.1:6379> XCFGSET events IDMP-MAXSIZE 10001
(error) ERR IDMP-MAXSIZE must be between 1 and 10000 entries
127.0.0.1:6379> XCFGSET events IDMP-DURATION 5 IDMP-DURATION 6
(error) ERR IDMP-DURATION specified multiple times
127.0.0.1:6379> XCFGSET events IDMP-DURATION abc
(error) ERR value is not an integer or out of range
127.0.0.1:6379> XCFGSET events
(error) ERR At least one parameter must be specified
127.0.0.1:6379> XCFGSET events BOGUS 1
(error) ERR syntax error
127.0.0.1:6379> XCFGSET events IDMP-DURATION
(error) ERR syntax error
127.0.0.1:6379> SET plain 1
OK
127.0.0.1:6379> XCFGSET plain IDMP-DURATION 5
(error) WRONGTYPE Operation against a key holding the wrong kind of value

A Redis 8.6 command.

XADD, XINFO STREAM, XLEN