Skip to content

Add Actor State TTL support - #1921

Open
adityav1709 wants to merge 6 commits into
dapr:masterfrom
adityav1709:actor-state-ttl-1338-dco2
Open

adityav1709 wants to merge 6 commits into
dapr:masterfrom
adityav1709:actor-state-ttl-1338-dco2

Conversation

@adityav1709

Copy link
Copy Markdown

Fixes #849.

This builds on #1338, rebased onto current master.

What it does

  • Adds an overload to save actor state with a TTL, while add(String, T) and set(String, T) stay as they are. No @deprecated on set while the feature is in preview.
  • DaprClientImpl sends ttlInSeconds on save and reads ttlExpireTime on read, so the ActorStateManager cache knows when a key expires.
  • Removes unused imports in DaprStateAsyncProvider.
  • Preview feature flags are now supported in the testcontainers Configuration, so the test can enable ActorStateTTL.

Tests

  • New TTL integration test on MySQL with the ActorStateTTL preview flag enabled. Other actor tests stay on Redis, because Redis does not return ttlExpireTime.
  • Unit tests cover ttlInSeconds and ttlExpireTime handling in DaprClientImpl.

Caveat: the cache only knows a key expired when the store returns ttlExpireTime. Redis does not, so the MySQL test is the one that proves the expiry path.

Signed-off-by: Aditya <adityav170920@gmail.com>
Signed-off-by: Aditya <adityav170920@gmail.com>
Signed-off-by: Aditya <adityav170920@gmail.com>
Signed-off-by: Aditya <adityav170920@gmail.com>
Signed-off-by: Aditya <adityav170920@gmail.com>
@adityav1709
adityav1709 requested review from a team as code owners November 23, 2026 11:15
@adityav1709 adityav1709 changed the title [stage] Add Actor State TTL support Add Actor State TTL support Nov 24, 2026
Signed-off-by: Aditya <adityav170920@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEATURE PREVIEW: Add Actor State TTL support

1 participant