State of the embedded key-value storage

When you want to use a key-value database on iOS, you have mainly the following options:

  • Berkeley DB: You’re stuck with the version 1.x. There’s some licensing issue with the versions >= 2.0.
  • SQLite: It’s not optimal to use it as a key-value storage since it’s a relational database.
  • Tokyo Cabinet: The license is LGPL, which makes it difficult to use on iOS.
  • LMDB: You need to know the maximum size of the database when you create it. It cannot adjust the size of the database depending on the size of the data you store in it.
  • LevelDB: It uses a large number of file descriptor. It can reach the limit of 256 files per process just for one database.

That’s why I wrote kvdb. It implements:

  • a key-value storage (kvdb)
  • an ordered key-value storage (kvdbo)
  • a full text search database compatible with Unicode (sfts)

They’re all using only one file to store the data. It’s a BSD license. It’s available on GitHub.