Skip to content

feat(cache): conditional refresh with GetOrRevalidateAsync - #574

Open
cosmin-staicu wants to merge 1 commit into
mainfrom
feat/conditional-refresh
Open

cosmin-staicu wants to merge 1 commit into
mainfrom
feat/conditional-refresh

Conversation

@cosmin-staicu

@cosmin-staicu cosmin-staicu commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Problem

A cache generator can fetch a replacement value, but it needs the previous value and its validators to ask the source whether that value is still current.

Change

GetOrRevalidateAsync gives typed and untyped cache callers a generator context with the previous value, its ETag and last-modified timestamp when available. A generator can return Modified to replace the value or NotModified from the supplied context to renew the kept value. Revalidation works with background rehydration and on expiry with fail-safe. The generator analyzers cover the new overloads, and allocation tests pin the hit and miss paths.

The API takes a single CacheKey. Batch and hash calls, Span<char> and CacheKeyHandler keys, and a GetOrAddResult counterpart are outside this release. The stored-value and broadcast wire formats stay unchanged.

The overload guide covers both policies and when to send a conditional request. The resilience guide links to the recipes, the interfaces reference and glossary document the API and validators, and the changelog records the feature.

Behaviour change

Conditional refresh is opt-in through GetOrRevalidateAsync. Existing GetOrAddAsync calls keep their overload bindings.

Release net10.0 recorded 9,246 passed and 275 skipped in Caching, 226 passed and 0 skipped in Analyzers, 2,166 passed and 59 skipped in Migration, and 67 passed and 0 skipped in PluginContract.

Release net8.0 recorded 9,200 passed and 278 skipped in Caching, 226 passed and 0 skipped in Analyzers, 2,166 passed and 59 skipped in Migration, and 67 passed and 0 skipped in PluginContract.

@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch 3 times, most recently from 9a816c9 to d7ee8d5 Compare November 29, 2026 17:03
@cosmin-staicu
cosmin-staicu marked this pull request as ready for review November 29, 2026 17:06
@github-actions github-actions Bot added the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off.

Strong signals

  • adds public API surface (PublicAPI.Unshipped.txt in src/UiPath.Caching.Abstractions)

Other signals

  • large production change (+1114 lines under src/)

This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.

  • If a CLA is needed → add the cla-required label (a contributor comment with signing steps is posted automatically).
  • If it is not needed → replace needs-cla-review with cla-not-required so later pushes don't re-flag it.

@cosmin-staicu cosmin-staicu self-assigned this Nov 29, 2026
@cosmin-staicu cosmin-staicu removed the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@cosmin-staicu cosmin-staicu changed the title feat(cache): conditional refresh with GetOrRevalidateAsync feat(cache): conditional refresh with GetOrAddAsync Nov 29, 2026
@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch from d7ee8d5 to c4540e2 Compare November 29, 2026 18:59
@github-actions github-actions Bot added the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off.

Strong signals

  • adds public API surface (PublicAPI.Unshipped.txt in src/UiPath.Caching.Abstractions)

Other signals

  • large production change (+1153 lines under src/)

This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.

  • If a CLA is needed → add the cla-required label (a contributor comment with signing steps is posted automatically).
  • If it is not needed → replace needs-cla-review with cla-not-required so later pushes don't re-flag it.

@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch from c4540e2 to 2079b8a Compare November 29, 2026 19:24
@cosmin-staicu cosmin-staicu removed the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@cosmin-staicu cosmin-staicu changed the title feat(cache): conditional refresh with GetOrAddAsync feat(cache): conditional refresh with GetOrRevalidateAsync Nov 29, 2026
@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch from 2079b8a to f19ec47 Compare November 29, 2026 20:19
@github-actions github-actions Bot added the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off.

Strong signals

  • adds public API surface (PublicAPI.Unshipped.txt in src/UiPath.Caching.Abstractions)

Other signals

  • large production change (+1185 lines under src/)

This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.

  • If a CLA is needed → add the cla-required label (a contributor comment with signing steps is posted automatically).
  • If it is not needed → replace needs-cla-review with cla-not-required so later pushes don't re-flag it.

@cosmin-staicu cosmin-staicu removed the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch from f19ec47 to 5d51fb4 Compare November 29, 2026 20:32
@github-actions github-actions Bot added the needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md) label Nov 29, 2026
@github-actions

Copy link
Copy Markdown

🔎 Maintainer heads-up: automated triage flagged this PR as potentially material, so it may need a signed CLA in addition to the DCO sign-off.

Strong signals

  • adds public API surface (PublicAPI.Unshipped.txt in src/UiPath.Caching.Abstractions)

Other signals

  • large production change (+1185 lines under src/)

This is advisory only — the bot does not decide. Please judge against the CLA criteria (material, product-critical, patent-sensitive, corporate contributor, broad commercial use). Note that thresholds can be gamed by splitting PRs, so use your judgement.

  • If a CLA is needed → add the cla-required label (a contributor comment with signing steps is posted automatically).
  • If it is not needed → replace needs-cla-review with cla-not-required so later pushes don't re-flag it.

@cosmin-staicu
cosmin-staicu force-pushed the feat/conditional-refresh branch 2 times, most recently from 9f0f1af to 1f3bb0a Compare November 29, 2026 21:37
Add GetOrRevalidateAsync with a RevalidationContext<T> that carries the previous value, its ETag and Last-Modified, and RevalidatedValue<T> with Modified and NotModified. Validators ride in entry metadata and never in events. A miss revalidates through the fail-safe pipeline with the soft timeout, and rehydrate revalidates in the background. A NotModified is bound to the context that made it. Analyzers cover the new members; docs and changelog describe the recipes and limits.

Signed-off-by: Cosmin Staicu <cosmin.staicu@uipath.com>
@sonarqubecloud

Copy link
Copy Markdown

@cosmin-staicu
cosmin-staicu marked this pull request as ready for review November 29, 2026 22:03

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

needs-cla-review A maintainer should assess whether a signed CLA is required (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant