Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to persist/cache data in cross platform Mono App (eg. Xamarin Framework)?

I'm looking for a good solution to store and/or cache data in a cross platform App developed in C# (Xamarin's MonoTouch & MonoDroid + WindowsPhone). Simple Key/Value Pairs would be sufficient. The stored data will to be used as general caching and as persistence to show something on App startup while new data is fetched from the server.

Akavache looks very much like what I want but how to integrate it in my projects? Will it choose the right path's for storing? Are there similar libraries around?

like image 297
Rodja Avatar asked Aug 02 '12 13:08

Rodja


1 Answers

I have not tried Akavache jet but rather implemented a cross-plattform wrapper around the preference APIs on Android and iOS:

var storage = SimpleStorage.EditGroup("group name of key/value store");
storage.Put("myKey", "some value");
var value = storage.Get("myKey");

The project is hosted on GitHub and distributed as a free NuGet Package. Along string storing it also provides async/await methods and serializing/deserializing of complex objects.

like image 139
Rodja Avatar answered Oct 23 '22 05:10

Rodja