Skip to content

Conversation

@daan944
Copy link
Contributor

@daan944 daan944 commented Aug 18, 2025

Hi,

I'm adding a cache to my application, and need the stored remaining TTL of the stored entry to be able to support stale while revalidate.

I've added a ttl(key) method to expose the TTL in ms (compliant with the maxAge option), and added tests.

Thanks!

@sindresorhus
Copy link
Owner

You also need to add it to the readme

@daan944
Copy link
Contributor Author

daan944 commented Aug 20, 2025

Updated as requested.

No rush in releasing this, in the meantime we pivoted and are going to apply a different strategy to caching. But I suspect others will be happy with this change.

@sindresorhus sindresorhus merged commit 6c0efa5 into sindresorhus:main Aug 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants