Skip to content

[Cache metadata] Allow to return cache metadata from getOrSet() #91

Description

@MarcLopezAvila

It would be extremely helpful if getOrSet() could return not only the cached value but also basic metadata, for example: creation time, expiration time, and whether the result was a hit, miss, stale, or refreshed.

Why

  • To easily generate proper HTTP caching headers such as ETag, Age, Last-Modified, and Cache-Status.
  • To report cache status (MISS, HIT, STALE, REFRESHED) in API responses without having to call getEntry() again.
  • To avoid redundant cache lookups and logic when building observability or cache debugging tools.
Image

Is there a way to retrieve this information right now with the current methods? We want to use this library in our microservices but this is a blocker.

Thanks!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions