Friday, July 04, 2014

SQLitePCL vs Akavache

Earlier this week I shared the news that there is now an "official(ish)" version of SQLite that can be used in what Microsoft calls "Universal Apps".

I was asked how this compares with using Akavache and if I have any recommendations?

If you're not familiar Akavache it's "an asynchronous, persistent key-value store for native applications". In that it can use SQLite as its data store and that both can be used in Windows and Windows Phone apps then the comparison question becomes even more relevant.

That's to risk potential confusion though. The underlying data source isn't really relevant. What matters is what their purpose is and what they're capable of.

The first big difference between the two options is in the type of data they can store. SQLite allows the storing of relational data. (It is a relational database after all.) Akavache can just store key-value pairs.

Of course you could just store key-value data in SQLite yourself. So why use Akavache?
The answer lies in what it adds beyond just being a key-value store. It is designed for working with (and storing) remote data that may be cached. Whether that's HTTP response, images or JSON data. Akavache adds more than just a key value store it provides smart logic for retrieving and caching remote resources.

So, my recommendation is that if you only need to store remotely sourced key-value pairs then use Akavache. If you need to store relational data then use SQLite.

14 comments:

  1. Great article. One thing that definitely leads you to using raw SQLite3 over Akavache is if you need *queries* over data - i.e. if you need to say, "Give me all the Twitter messages from April 4th", Akavache won't be great at that. It is great at doing many tasks that typical client apps do, like serializing objects for you, or refreshing a list while returning you the cached items.

    You can always use Akavache and SQLite3 together though, and in fact, in Akavache 4.0 we'll expose the database connection directly so that you can glom onto the existing database for your own tables.

    ReplyDelete
    Replies
    1. (This is Paul, the author of Akavache, but this comment frame is getting Confused™)

      Delete
  2. Thank you Matt and Paul, such nuggets are invaluable.

    ReplyDelete
  3. Anonymous4:28 pm

    This comment has been removed by a blog administrator.

    ReplyDelete
  4. This is a great web site. Good sparkling user interface and very informative blogs. I will be coming back in a bit, thanks for the great article. I have found it enormously useful..
    unblockedgames| unblocked games at school
    friv 4 school| friv4school
    free online games| free online games
    top tetris games
    monster high games| play monster high games
    kizi 2| kizi

    ReplyDelete
  5. Big Farm

    Big Farm is an awesome multiplayer farm management game made by the Goodgame Studios.
    Your mission is simple: Create a big farm, grow crops, breed animals,
    and become the richest farmer of the universe. Enjoy Goodgame's Big Farm!

    ReplyDelete