XCFGSET

XCFGSET key [IDMP-DURATION duration] [IDMP-MAXSIZE maxsize]
Available since:
Redis Open Source 8.6.0
Time complexity:
O(1)
ACL categories:
STREAM,

Sets the IDMP (Idempotent Message Processing) configuration parameters for a stream. This command configures how long idempotent IDs are retained and the maximum number of idempotent IDs tracked per producer.

Required arguments

key

The name of the stream key. The stream must already exist.

Optional arguments

IDMP-DURATION duration

Sets the duration in seconds that each idempotent ID (iid) is kept in the stream's IDMP map. Valid range: 1-86,400 seconds. Default: 100 seconds.

When an idempotent ID expires, it can be reused for new messages. This provides an operational guarantee that Redis will not forget an idempotency ID before the duration elapses (unless capacity is reached).

IDMP-MAXSIZE maxsize

Sets the maximum number of most recent idempotent IDs kept for each producer in the stream's IDMP map. Valid range: 1-10,000 entries. Default: 100 entries.

When the capacity is reached, the oldest idempotent IDs for that producer are evicted regardless of remaining duration. This prevents unbounded memory growth.

Behavior

  • Calling XCFGSET clears all existing producer IDMP maps for the stream.
  • At least one of IDMP-DURATION or IDMP-MAXSIZE must be specified.
  • The stream must exist before calling this command.
  • Configuration changes apply immediately to all future IDMP operations.

Examples

XADD mystream * field value
XCFGSET mystream IDMP-DURATION 300
XCFGSET mystream IDMP-MAXSIZE 1000
XCFGSET mystream IDMP-DURATION 600 IDMP-MAXSIZE 500

Return information

Simple string reply: OK if the configuration was set successfully.

Error conditions

The command returns an error in the following cases:

  • WRONGTYPE: The key exists but is not a stream
  • ERR no such key: The stream does not exist
  • ERR syntax error: Invalid command syntax or missing required arguments
  • ERR invalid duration: Duration value is outside the valid range (1-86,400)
  • ERR invalid maxsize: Maxsize value is outside the valid range (1-10,000)
RATE THIS PAGE
Back to top ↑