-
Notifications
You must be signed in to change notification settings - Fork 74
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
is there support for indexeddb? #273
Comments
Yea we could add a new cache adapter re: src/cache/adapters/localStorage.ts |
I tried making one using idb-key-value, but the inherent issue is that the Cache adapter methods cannot be async, while IndexedDB's API is. So this would also require a change to the Caching base class and implementation. |
even with localforage? |
@CavalcanteLeo As long as a library/anything requires async operations, it currently cannot be done as the cache adapter's methods don't allow async methods. That includes LocalForage, as per their own documentation:
The entire IndexedDB API (the low-level browser type) is a promise-based API. As long as the Cache adapters can't work with As my current schedule is a bit tight, I can't promise (pun intended) I'll have time shortly, but I could try looking into making a PR to resolve the issue. The only alternative for a short-term fix is use some workaround to de-promise-ify the library calls. That would mean using some wrapper function that waits until the promise is resolved before continuing, but this will definitely hurt performance, which is what you don't want. |
@darrenjennings Are there any plans to make the cache adapters optionally support promises, or is this something that's not planned? |
May be we can add in dexie db. |
@edson-pro That would retain the same issue. Dexie relies on Indexed DB, so you'd need to un-async the asynchronous API from Indexed DB itself. This would require a change in the library to accept async (promise) type functions for its cache adapter. Which, seemingly, we're not getting. As this issue is still open without any response from the devs 😞 |
yeah, I get it @ZeroThe2nd, Thanks for the response. |
Hey, sorry everyone I just saw this thread. |
for our needs the size of local storage is not sufficient, the goal is to load from cache on subsequent visits
I know indexeddb is an old solution but I am not aware of another solution that can replace it.
The text was updated successfully, but these errors were encountered: