I'm in the early stages of an Ionic app which will require data persistence. The interactions will be numerous (10/day) and will have to be listed, averaged, and synced with a webservice. One "monkey wrench" which isn't decided yet, is that I may have to encrypt the data stored on device.
In terms of persistence layer, I'm evaluating 3 possibilities including
- sqlite - via ngCordova http://ift.tt/1C8mOwF
- indexedDB - via W3C spec http://ift.tt/1jBuaHx
- local storage - via W3C http://ift.tt/1LzHWld
In terms of my own preference, The "hammer" of a database is the one I'm most comfortable with but it has the drawback of making the web-page based development difficult because the CORDOVA object is not supported in chrome.
If I go with that option, development will ONLY be possible using the emulators and devices.
Meanwhile, I have no experience of the indexedDB api in the ionic framework and I'm not certain local storage has the "queriability" I need.
With local storage I may be able to "hack" the features and performance I need by storing more keys and values. For example: instead of calculating an average from the data, I could store the sum and number of entries and update/increment as the user progresses. Instead of querying local storage for "unsynchronized entries" I could store a list of the keys of entries that haven't been synced yet.
At this greenfield stage however, I'm not sure if the overhead in local-storage workarounds is a rabbit-hole / can of worms.
What are the pros and cons of each storage method and which should I chose?
Aucun commentaire:
Enregistrer un commentaire