set

fun set(key: String, value: Any, retention: Duration? = null)

Stores value under key, replacing any existing value.

Parameters

key

State key.

value

Value to store. Must be JSON-serializable.

retention

How long to keep the key. Must be positive, or NEVER_EXPIRE; null uses [state_store] default_retention_days.

Throws

if retention is zero or negative, or the default retention from the environment is not a non-negative integer.

if retention is null and the coordinator did not pass [state_store] default_retention_days to the JVM.

if the API call fails.