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(lru-cache): allow passing options to leverage stale-while-revalidate strategy #321

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

patzick
Copy link
Contributor

@patzick patzick commented Oct 13, 2023

πŸ”— Linked issue

  • no related issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

  • replaced cache.get withcache.fetch. it is not a breaking change. The usage is the same

If fetch method is not provided, then cache.fetch(key) is equivalent to Promise.resolve(cache.get(key)).

source in docs

  • that allows to provide fetchMethod for the driver and use stale-while-revalidate strategy to improve cache performence
  • added docs entry to inform about that possibility

Sidenote

This PR will conflict with #320 as I wanted to create two separate PRs because the overall scope differs.
I'll update this or the other PR whenever the second one is merged.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@nuxt-studio
Copy link

nuxt-studio bot commented Oct 13, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
unstorage Edit on Studio β†—οΈŽ View Live Preview 85347dd

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 64.83%. Comparing base (f6841df) to head (9c61054).
Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
+ Coverage   64.79%   64.83%   +0.03%     
==========================================
  Files          41       40       -1     
  Lines        4071     4072       +1     
  Branches      489      488       -1     
==========================================
+ Hits         2638     2640       +2     
  Misses       1422     1422              
+ Partials       11       10       -1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@patzick
Copy link
Contributor Author

patzick commented Nov 14, 2023

@pi0 thanks for merging #320, The conflict with this PR is resolved and it's ready to be merged too :)

@pi0 pi0 added the enhancement New feature or request label May 1, 2024
@pi0 pi0 changed the title feat(driver): lru-cache allowing stale-while-revalidate strategy feat(lru-cache): allow passing options to leverage stale-while-revalidate strategy May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants