Refresh cache keys in background
Both the caching and multicaching modules support a mechanism to refresh expiring cache keys in background when using the wrap
function.
This is done by adding a refreshThreshold
attribute while creating the caching store or passing it to the wrap function.
If refreshThreshold
is set and after retrieving a value from cache the TTL will be checked.
If the remaining TTL is less than refreshThreshold, the system will update the value asynchronously,
following same rules as standard fetching. In the meantime, the system will return the old value until expiration.
What's Changed
- Add refreshThreshold as parameter of wrap function. Fix #606 by @lchenay in #630
- upgrading vitest to 1.2.1 by @jaredwray in #634
- updating eslint and prettier to latest by @jaredwray in #635
- fixing multi-cache testing of ttl wrap function by @jaredwray in #636
Full Changelog: v5.3.2...v5.4.0