Beispiel #1
0
 /// <summary>
 /// 缓存角色信息
 /// </summary>
 /// <returns></returns>
 private bool CacheRole(DataCacheProvider Provider)
 {
     try
     {
         string      sql     = "select * from de2_user_roletype";
         MySqlClient _Client = new MySqlClient();
         var         result  = _Client.ExecuteQuery <RoleType>(sql);
         return(Provider.SetCache("roetype", result));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "缓存角色信息", "CacheRole", ex);
         return(false);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 设置缓存
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="Provider"></param>
 /// <param name="JSONPath"></param>
 /// <returns></returns>
 private bool SetCache <T>(DataCacheProvider Provider, string JSONPath)
 {
     try
     {
         List <T>     result        = new List <T>();
         JsonDataHelp _JsonDataHelp = new JsonDataHelp();
         result = _JsonDataHelp.GetJsonData <List <T> >(JSONPath);
         return(Provider.SetCache(JSONPath, result));
     }
     catch (Exception ex)
     {
         LogFactory _LogFactory = new LogFactory(this.GetType());
         _LogFactory.CreateLog(LogType.Error, "设置缓存", "SetCache", ex);
         return(false);
     }
 }