Sqlite 3与NSCoding协议 [英] Sqlite 3 vs NSCoding Protocol

查看:175
本文介绍了Sqlite 3与NSCoding协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种存储缓存数据更有效。我看到Twitter for Mac在sqlite文件中存储了一大堆信息。有些应用程序实现了NSCoding协议。

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.

是否有任何优势?

推荐答案

两者完全不同。 SQLite是一个关系数据库,围绕 NSCoding 的东西是一种对象序列化技术。选择取决于您的缓存数据。如果你的缓存是一堆对象,我肯定会选择 NSCoding ,因为它非常简单,比原始SQLite简单得多。一旦磁盘缓存中有数千个对象并且不想一次加载所有这些对象,您可能更适合SQLite。

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.

这篇关于Sqlite 3与NSCoding协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆