SQLite与LocalStorage [英] SQLite vs LocalStorage
问题描述
我正在使用Ionic 2.
I am using Ionic 2.
我有一个简单的聊天应用程序,它使用Meteor来同步用户之间的消息。在此阶段,所有消息都存储在服务器上的 Mongodb
数据库中。它工作得很好。
I have a simple Chat App which uses Meteor to sync the messages between users. At this stage, all messages are stored on the server in a Mongodb
database. It works perfectly.
但是,我确实希望将消息存储在使用本地设备上,而不是从服务器下载,就像 WhatsApp
确实。
I do however, want to store the messages on the uses local device rather, once downloaded from the server, much like WhatsApp
does.
问题
我是否应该使用本地存储或 SQLite ?
我倾向于本地存储因为对象我保存非常简单(只需键
和字符串
)。
I am leaning towards Local Storage because the object I save are pretty simple (just a key
and a string
).
本地存储
我打算用简单的 JSON
保存邮件用键。
SQLite
我之前从未使用过这个,但是理解正常的SQL。
SQLite I have never used this before, but understand normal SQL.
推荐答案
由于您的数据将是简单的对象,因此建议您使用NoSQL DB而不是SQLite
Since your data will be simple objects , it is recommended you go for NoSQL DB instead of SQLite
在NoSQL数据库中,您可以将应用程序数据存储在文件中。您可以自由地按照您的结构存储对象,如您的情况 - 键值对。即使在卸载应用程序后,应用程序数据也会持续存在,因为您可以将数据存储在设备的外部存储空间中。
In NoSQL Database you can store your app data in files.You will have the liberty to store your objects as per your structure, as in your case - key value pairs. Even after uninstalling the app, the app data will be persistent as you can store the data in external storage of the device
我建议请通过
它是一个非常好的Android NoSQL DB库。
Its a very good library for android NoSQL DB.
这篇关于SQLite与LocalStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!