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

feat: persistent max age #297

Merged
merged 2 commits into from
Jul 3, 2024
Merged

feat: persistent max age #297

merged 2 commits into from
Jul 3, 2024

Conversation

borisdiakur
Copy link
Owner

Resolves #289

💥 BREAKING CHANGE 💥

The maxAge option now ensures that the cache becomes invalid after the specified cache lifetime is reached based on stats.mtimeMs (last modification time of the cache file) instead of relying on an in memory timeout that invalidates the cache. This ensures that cache lifetimes are evaluated correctly between multiple processes.

How to upgrade

If you are using the maxAge option, ensure that you add the option to every memoizer.fn call (if you have multiple) to reliably check cache validity. Most probably this is already the case in your application, and you don't need to change anything.

@borisdiakur borisdiakur merged commit f40ef03 into main Jul 3, 2024
2 checks passed
@borisdiakur borisdiakur deleted the feat/persistent-max-age branch July 3, 2024 20:46
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.

maxAge should be stored in file instead of setTimeout, so cache is properly invalidated across several runs
1 participant