UNLIMITED JAVA

WEB技術や普段の生活のブログ

ChoBase公開

MonoTouch向けキーバリューストア「ChoBase Version 0.2」をリリースしました。


MonoTouchでのデータ永続化がちょー簡単に出来るツールです。
接続文字列とかスキーマとか意識しなくていいので、サクサク開発出来るハズ。

簡単な使い方。

//キーを使って、値のセットと取得
//set string value by key.
//get string value by key.
const string key = "myKey";
ChoBase.SetS(key, "value");
Console.WriteLine(ChoBase.GetS(key)); // >> value

//キーを使って、オブジェクトをシリアライズ。
//set/get instance by key. instance is serialized with json.
Uri uri = new Uri("http://hoge");
ChoBase.SetJ(key, uri);
var newUri = ChoBase.GetJ<Uri>(key);
Console.WriteLine(newUri.OriginalString); // >> http://hoge

//キーの有無のチェック
//chack contains key.
bool contains = ChoBase.ContainsKey(key);    //if exists the key > true

//キーの削除
//remove the value by key.
int count = ChoBase.Remove(key); //Remove the key and get count of deleted keys.

//引数を使ったキーのセットと取得
//set/get value by key and args.
const string arg1 = "myArg";
ChoBase.SetS(key, "value2", arg1);
Console.WriteLine(ChoBase.GetS(key, arg1)); // >> value2

//キーの前方一致で検索
ChoBase.ScanByKey(key, SortDirections.Asc);