Skip to content

Feature: metadata/status #143

@TorbjornHoltmon

Description

@TorbjornHoltmon

We use cachified in many different contexts in our apps, and we love it.
And we would really love to have the possibility to see cache status from a cache result, in some way or another.

const cachifiedResult = await cachifiedWithMetadata({
  key: `user-${userId}`,
  cache: ourCache,
  async getFreshValue() {
    ...
  },
  ttl: 300_000,
});

console.log(cachifiedResult.status) // "HIT", "MISS" or "REVALIDATING"
console.log(cachifiedResult.value) // Cached, or fresh value

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions