Sqlite 3 vs NSCoding Protocol

百般思念 提交于 2019-12-22 00:38:35

问题


Which is more efficient for storing cache data. I see Twitter for Mac stores blobs of information inside a sqlite file. Some apps implement NSCoding protocol.

Is there any advantage of one over another?


回答1:


The two are quite different. SQLite is a relational database, the stuff around NSCoding is an object serialization technique. The choice depends on your cache data. If your cache is a bunch of objects, I’d certainly go for NSCoding, as it’s very simple to work with, much simpler than raw SQLite. Once you have thousands of objects in the disk cache and don’t want to load all of them at once, you might have a better fit for SQLite.




回答2:


Rather than dealing with SQL complexity, you may want to give a try to something like CoreData than can store object-graphs pretty easily.

If you need to store binary data CoreData can also do this but you shall considerer data size when you specify the data model.

Check Marcus Zarra speech on this subject at :

  • http://ideveloper.tv/freevideo/details?index=17089146
  • http://ideveloper.tv/freevideo/details?index=17295063

You may find other interesting information on this one by Aaron Hillegass:

  • http://ideveloper.tv/freevideo/details?index=17081942


来源:https://stackoverflow.com/questions/4989609/sqlite-3-vs-nscoding-protocol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!