Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache-manager: wrap() method - support refreshThreshold argument as Function #975

Merged

Conversation

yaronyam
Copy link
Contributor

cache-manager: wrap() method - support refreshThreshold argument as number or Function of (value:T) => number. Similar to how ttl is supported.

Motivation

refreshThreshold is ideally defined in proportion to ttl - which is supported also as a Function.
One popular use case for example: caching jwt tokens - cache ttl should be set according to returned jwt expiration. Likewise, refreshThreshold needs to be set proportionally. Especially when different clients change their jwt token lifetime dynamically.

…umber or Function - (value:T) => number. similar to how ttl is supported
@jaredwray
Copy link
Owner

@yaronyam - can you get the lint errors fixed?

@yaronyam
Copy link
Contributor Author

Yes, fixed.

@jaredwray jaredwray merged commit fd4bb94 into jaredwray:main Jan 14, 2025
3 checks passed
@jaredwray
Copy link
Owner

@yaronyam - thanks. This should be live in a week or so.

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