Skip to content

Feature request: Add maxAge option for cached values #258

@nulladdict

Description

@nulladdict

We currently have dedupingInterval option, which acts as a soft TTL for cached values, meaning that after this timeout hits we still use cached value but need to revalidate it.

I propose adding maxAge option, which would act as a hard TTL, meaning that when this timeout we can no longer use cached value, and have to hard revalidate it (return undefined / suspense depending on options).

This effectively allows to create a boundary, where stale value is okay to use, and the timeline would look something like this:
image

I believe after #231 gets merge this could be possible to do outside of the library by clearing the cache when maxAge hits, but I believe this feature is good enough to be built-in

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions