unstorage
unstorage copied to clipboard
feat(lru-cache): allow passing options to leverage stale-while-revalidate strategy
๐ Linked issue
- no related issue
โ Type of change
- [x] ๐ Documentation (updates to the documentation, readme, or JSdoc annotations)
- [ ] ๐ Bug fix (a non-breaking change that fixes an issue)
- [x] ๐ 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, thencache.fetch(key)
is equivalent toPromise.resolve(cache.get(key)).
- that allows to provide
fetchMethod
for the driver and usestale-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.
- [x] I have updated the documentation accordingly.
Live Preview ready!
Name | Edit | Preview | Latest Commit |
---|---|---|---|
unstorage | Edit on Studio โ๏ธ | View Live Preview | 85347dda2360167fdb7401df3aa1f9e039fbbd96 |
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@pi0 thanks for merging #320, The conflict with this PR is resolved and it's ready to be merged too :)