-
Notifications
You must be signed in to change notification settings - Fork 304
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
PnP Js caching Indexed DB support #2046
Comments
With version 3 you will be able to write your own custom |
Here's an example of a custom behavior I wrote that I called "Pessimistic Caching" as an example: https://github.com/pnp/pnpjs/blob/version-3/packages/queryable/behaviors/caching-pessimistic.ts |
This is a cool idea, but for sure want to wait for v3 coming very soon. You should be able to use Julie's example or the simpler basic caching as an example. |
Ok thanks, I will take a look into it. I still suggest for indexed DB support to be supported in the same way as local and session storage, using a simple configuration. Do you think this is possible? Thanks |
We are targeting the middle of this month, but have other dependencies that are somewhat out of our hands...
Maybe... It's hard to say without digging deep and figuring out how we could make that simple implementation. I suspect the answer is figuring out how to get IndexedDB configuration to fit into |
Or just make it a fully independent behavior. The caching behavior uses the storage wrapper, but the same pattern could be used with index db. Then avoid needing to stuff it into the same pattern. |
Thanks for the comments @juliemturner and @patrick-rodgers. Although I see a custom provider as a way, since indexed db is widely used, it would make sense for it to be available using a simple configuration and if possible and for the developer to use the .useCaching method in the pnp js calls. Custom providers will be great for the scenarios where developers want to store data in less conventional stores. Indexed DB is a widely used storage and supported by the modern browsers and it would be a great addition to pnp js :) I will await the release if this is implemented :). Either way, great job with the PnP initiative and with pnp js. Thanks |
Looking into this and I am still reluctant to include an indexDB implementation within the library because it is much more complicated than the simple key/value of session/local storage. I also believe that many folks would have many opinions on how something like this should work, meaning we would need to provide access to the full indexDB API either through configuration (too complicated) or some form of call backs. indexDB is also something we can't shim like we do in node for session/local storage. I don't doubt using indexDB would be helpful in many scenarios - it just doesn't seem like something we should own the implementation of for everyone. There are also lots of libraries available that wrap it - would be great to have something added to the recipes page if you're up for it. This is also aligned with the decision to take Proxy support out of the library and including the example. |
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked. |
Category
Hello,
Is it possible to add Indexed DB support for caching in PnP JS?
In https://pnp.github.io/pnpjs/odata/caching/, I see that only local and session storage is supported.
Thanks
Miguel
The text was updated successfully, but these errors were encountered: