Esempio n. 1
0
 public RedisHelper(int dbNum, string readWriteHosts)
 {
     DbNum = dbNum;
     _conn =
         string.IsNullOrWhiteSpace(readWriteHosts) ?
         RedisConnectionHelper.Instance :
         RedisConnectionHelper.GetConnectionMultiplexer(readWriteHosts);
 }
Esempio n. 2
0
 private T Do <T>(Func <IDatabase, T> func)
 {
     try
     {
         var database = _conn.GetDatabase(DbNum);
         return(func(database));
     }
     catch (Exception ex)
     {
         Task.Run(() => RedisConnectionHelper.WrtieRedisLog(Common.LogLevel.Error, ex.Message));
         throw ex;
     }
 }