Skip to content

Add stale-while-revalidate completion notification #8

@marcstraube

Description

@marcstraube

Context

CacheManager returns stale data immediately during revalidation but does not notify the consumer when background revalidation completes with fresh data.

Goal

Notification mechanism so reactive UIs can update when fresh data arrives.

Implementation

  1. Add optional onRevalidate callback to cache config
  2. Call with fresh data when background fetch completes
  3. Alternative: return { data, revalidating: Promise } tuple

Files

  • src/cache/CacheManager.ts
  • tests/cache/CacheManager.test.ts

Source: AUDIT4 (-1 Defense-in-Depth)

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort:mMedium (30 min - 2h)enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions