iPhone 上的 Tokyo Cabinet 与 SQLite3
有人用过 iPhone 上的 Tokyo Cabinet 吗? 我很想知道它和 SQLite3 之间是否存在实际性能差异。
另外,SQLite 3具有SQL的表达能力,Tokyo Cabinet有什么查询语言吗?
任何意见将不胜感激,谢谢。
Has anyone used Tokyo Cabinet on the iPhone? I'm interested to see if there are any real world performance differences between it and SQLite3.
Also, SQLite 3 has the expressive power of SQL, does Tokyo Cabinet have any kind of query language?
Any input would be greatly appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我没有专门在 iPhone 上使用过它们,但我在各种项目中都使用过它们。 正如您所指出的,SQLite 确实提供了 SQL 查询语言,这意味着您在搜索和查找数据的方式上拥有更大的灵活性。 假设您熟悉 SQL,您将能够轻松过滤、关联和聚合结果。
Tokyo Cabinet 提供了一种不同类型的数据存储系统,它是键值存储。 顾名思义,这些系统用于存储(键,值)对。 存储到TC中的数据必须有一个唯一的可以被引用的key,并且只能由该key来引用。 访问TC的接口基本上就是value=get(key)和set(key,value)。
从查询的角度来看,访问 TC 大致相当于使用 SQLite,并且只允许主键字段和一个其他数据字段。
TC 的主要优点是性能。 是否会好以及好多少在很大程度上取决于工作量。 一般来说,如果您需要的只是键值存储,那么您应该使用 TC,但如果您需要 SQL 查询语言,那么 SQLite 就是。
I have not used either on the iPhone specifically, but I have used both for various projects. Like you pointed out, SQLite does provide SQL query language which means you have much more flexibility in how you can search for and find data. Assuming you are comfortable with SQL you will be able to easily filter, relate, and aggregate results.
Tokyo Cabinet provides a different type of data storage system in that it is a key-value store. As the name implies, these systems are for storing (key,value) pairs. Data stored into TC must to have a unique key which it can be referenced, and it can only be referenced by that key. The interface for accessing TC is basically value=get(key) and set(key,value).
From a query perspective accessing TC is roughly equivalent to using SQLite and only allowing primary key fields and one other data field.
The major benefit of TC is performance. If and how much better it would be depends heavily on the workload. In general, if all you need is a key-value store then you should go with TC, but if you need a SQL query language then SQLite it is.
BNRPersistence 是一个基于 Tokyo Cabinet 构建的持久对象库,我认为它是一个非常好的解决方案。 网上有 Core Data 和 Tokyo Cabinet 之间的比较。
BNRPersistence is a persistence objects library build over Tokyo Cabinet, I think its a really nice solution. In the web there's a comparison between Core Data and Tokyo Cabinet.
Tokyo Cabinet 许可证不允许您进行静态链接,因此它不能用于 iPhone 开发。
The Tokyo Cabinet license doesn't let you do static linking so it cannot be used for iPhone development.