LevelDB is a key-value pair database developing by google. Why I use this instead of
Core Data which is so widely used.
Core Data is a framework deals with data in
Cocoa. It is extremly important but compliated. There are many concepts and problems in it. And every time I use
Core Data to fetch some datas, I have to write couple lines code.
This is so complicated and not elegant. I prefer to use
key-value storage instead of it in some situations. When data are not compliated and the relation between models are simple.
levelDB this way:
Just like dictionary and incredible simple to deal with.
LevelDB, the first thing you need to do is downlod repo on github
google/LevelDB or type this in terminal
And then you need to compile it.
Download the wrapper on this tanhao Just drag this all in your project.
The prepare work are all done.
But when I you this
levelDB to store data, I met some problems, if you want to store some data which is an object, you should make the
class of that
object to confirm
You need to implement this two methods, if not when you fetch the object from the data base, the compiler do not know what in it and what is it. So you should
encode the object propety before store them. And
decode the object when you fetch them. Work similar as
NSKeyedArchiver, if we have dozens of property, we have to write code for every property, after I find that I have to solve this problem in this approach. I think I want to write a
Meta Propgram in
Ruby to deal with this.
And I will do it after my second App on line.