ngneat / cashew

🐿 A flexible and straightforward library that caches HTTP requests in Angular
https://www.netbasal.com
MIT License
682 stars 33 forks source link

Async Storage Option #21

Open instantaphex opened 4 years ago

instantaphex commented 4 years ago

4 I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

HttpCacheStorage provides a synchronous interface.

Expected behavior

Allow for caching in async storage such as IndexedDB and other async storage options.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

I'm creating an Ionic/Capacitor application and I would like to be able to use Capacitor storage to work around the 5mb localStorage limit. I'm not able to do this because all of the Storage methods return promises.

Environment

All



NetanelBasal commented 4 years ago

You're welcome to submit a PR.

instantaphex commented 4 years ago

Ok great. I don't have time to do it right now, but I'll see if I can dig into it this weekend. Thanks for your work.

muuvmuuv commented 2 years ago

Ah well, I need this too. @instantaphex did you had some time digging into it?

fasidOnGit commented 1 year ago

I am willing to work on this. @NetanelBasal Do you have any specific approach in mind for this ?

IIUC, We need a totally new provider something like HttpCacheStorageAsync which should be extendable just like HttpCacheStorage but asyncified. :thinking:

If you have any tips on where to look or what approach to take please shoot it :)

DavidWiesner commented 1 year ago

There is the native Cache Web API wich perfectly match the issue description. In advance you can use different Caches from the CachStorage to provide versioning support. (Just in advance if anybody tries to implement this with the Cache API. There is an known performance issue in chrome when using cache.match with option ignoreSearch=true )