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): support options and fetchMethod #321

Open
wants to merge 5 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 58.78%. Comparing base (4d61c78) to head (ca1decc).
Report is 80 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
- Coverage   65.05%   58.78%   -6.28%     
==========================================
  Files          39       39              
  Lines        4055     3142     -913     
  Branches      487      527      +40     
==========================================
- Hits         2638     1847     -791     
+ Misses       1408     1286     -122     
  Partials        9        9              

☔ 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 May 1, 2024
@pi0 pi0 changed the title feat(lru-cache): allow passing options to leverage stale-while-revalidate strategy Oct 13, 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
2 participants