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: optional refresh strategy (stale-while-revalidate) #533 #586

Merged
merged 7 commits into from Sep 8, 2023

Conversation

jonathanarezki
Copy link
Contributor

Added refresh threshold, to update stores before the ttl runs out.
Only the wrap function is affected.
If the the remaining ttl of a store is smaller than the refresh threshold,
the store gets set with the fn asynchronously.
The refresh threshold is optional and is not stored in the store it self, only in the cache instance as a config.

@jaredwray
Copy link
Owner

@jonathanarezki thanks for doing this pull request. I will be reviewing this in the next 10 days and get back to you on this.

@jaredwray
Copy link
Owner

Also, please make sure to update your branch to the latest.

@jaredwray jaredwray self-requested a review September 7, 2023 17:41
@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2023

Codecov Report

Merging #586 (971cc7c) into master (5cb7ab1) will not change coverage.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff            @@
##            master      #586   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          283       292    +9     
  Branches        72        75    +3     
=========================================
+ Hits           283       292    +9     
Files Changed Coverage Δ
src/caching.ts 100.00% <100.00%> (ø)
src/multi-caching.ts 100.00% <100.00%> (ø)

📢 Have feedback on the report? Share it here.

@jaredwray
Copy link
Owner

@jonathanarezki can you update the readme with this new functionality?

@jonathanarezki
Copy link
Contributor Author

I updated the readme.

update: tests to be less time sensitive in slow environments
@jaredwray jaredwray merged commit d38d6d2 into jaredwray:master Sep 8, 2023
3 checks passed
@jaredwray
Copy link
Owner

@jonathanarezki - thanks and since this is not a non breaking change I will add it to the next release which should go out in the next couple weeks.

@jonathanarezki
Copy link
Contributor Author

Thank you really much. I didn't expect it to go that smooth.

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.

None yet

3 participants