//----------------------------------------------------------------------------- public override CEntity load(string entity_type, object param, Dictionary <string, object> cache_data) { string entity_id = (string)param; string db_key = entity_type + "_" + entity_id; Enyim.Caching.Memcached.Results.IGetOperationResult <string> ret = CCouchbaseClient.Instance.ExecuteGet <string>(db_key); if (ret.Success) { string json_map_prop = ret.Value; //mLog.Info("-------- Db Begin --------"); //mLog.Info("CEntitySerializerDb load entity from db: entity_type=" + entity_type + " entity_id=" + entity_id); //mLog.Info(json_map_prop); //mLog.Info("-------- Db End --------"); Dictionary <string, object> map_param = JsonConvert.DeserializeObject <Dictionary <string, object> >(json_map_prop); return(mpEntityMgr.createEntity(entity_type, entity_id, map_param, cache_data)); } else { //mLog.Error("CEntitySerializerDb::load() error! "); //mLog.Error("error load entity from db: entity_type=" + entity_type + " entity_id=" + entity_id); //mLog.Error(ret.Message); return(mpEntityMgr.createEntity(entity_type, entity_id, null, cache_data)); } }
//--------------------------------------------------------------------- public bool executeGet(string db_key, out string json_data) { Enyim.Caching.Memcached.Results.IGetOperationResult <string> ret = mCouchbaseClient.ExecuteGet <string>(db_key); if (ret.Success) { json_data = ret.Value; return(true); } else { json_data = null; return(false); } }