State Time-to-Live (TTL)
Dapr enables per state set request time-to-live (TTL). This means that applications can set time-to-live per state stored, and these states cannot be retrieved after expiration.
Only a subset of Dapr state store components are compatible with state TTL. For supported state stores simply set the metadata when publishing a message. Other state stores will ignore this value.
Native state TTL support
When state time-to-live has native support in the state store component, Dapr simply forwards the time-to-live configuration without adding any extra logic, keeping predictable behavior. This is helpful when the expired state is handled differently by the component. When a TTL is not specified the default behavior of the state store is retained.
To explicitly persist a state (ignoring any TTLs set for the key), specify a value of .
Supported components
State TTL can be set in the metadata as part of the state store set request:
Save the following in :
Related links
- Learn
- Read the API reference