adriancarriger / angularfire2-offline

🔌 A simple wrapper for AngularFire2 to read and write to Firebase while offline, even after a complete refresh.
https://angularfire2-offline.firebaseapp.com/
MIT License
207 stars 48 forks source link

Managing offline resource usage #56

Closed pscott-au closed 7 years ago

pscott-au commented 7 years ago

I am wondering how to manage the storage usage. I am using in an ionic mobile app ( iOS ) and am concerned that if I am accessing a lot of data that I should be managing or at least keeping an eye on the resource usage. Could we add a couple of lines into the docs to describe how this could be done and any advice on how this works,

adriancarriger commented 7 years ago

Hi @pscott-au, right now Afo will store all data from all references used.

Here are some ways to manage that:

Do these options work well for your use case?

pscott-au commented 7 years ago

Thanks @adriancarriger

Would I be correct to assume that if I wish to flush the local storage of a tree that I can call a reset from a subsequently subscribed parent in the tree or do I need to specifically reset the specific record set. eg. If I have an application that loads invoices into an Afo property that is in the FB hierarchy /invoices/$uid/$invoice_id would instantiating an Afo object of /invoices/$uid and calling a reset flush out all of the children stored locally?

adriancarriger commented 7 years ago

Hi @pscott-au, that's a great question!

If either of these options don't work well for your use case, then feel free to request an enhancement. Thanks! 👍

pscott-au commented 7 years ago

For me I find that doing a reset without params on logout seems to do the trick. Cheers.

adriancarriger commented 7 years ago

Awesome!