Пример #1
0
            internal override void AddLine(string key, string value)
            {
                var dbMatch = _dbNameMatch.Match(key);

                if (dbMatch.Success)
                {
                    var keysMatch = _keysMatch.Match(value);
                    if (keysMatch.Success)
                    {
                        try
                        {
                            var kd = new KeyData
                            {
                                Keys    = long.Parse(keysMatch.Groups[1].Value),
                                Expires = long.Parse(keysMatch.Groups[2].Value)
                            };
                            KeyData[int.Parse(dbMatch.Groups[1].Value)] = kd;
                            value = string.Format("{0} keys, {1} expires", kd.Keys.ToComma(), kd.Expires.ToComma());
                        }
                        catch (Exception e)
                        {
                            var ex = new Exception("Error Pasing " + key + ":" + value + " from redis INFO - Parsed Keys=" + keysMatch.Groups[1].Value + ", Expires=" + keysMatch.Groups[2].Value + ".", e);
                            Current.LogException(ex);
                        }
                    }
                }
                base.AddLine(key, value);
            }
Пример #2
0
 internal override void AddLine(string key, string value)
 {
     var dbMatch = _dbNameMatch.Match(key);
     if (dbMatch.Success)
     {
         var keysMatch = _keysMatch.Match(value);
         if (keysMatch.Success)
         {
             try
             {
                 var kd = new KeyData
                     {
                         Keys = long.Parse(keysMatch.Groups[1].Value),
                         Expires = long.Parse(keysMatch.Groups[2].Value)
                     };
                 KeyData[int.Parse(dbMatch.Groups[1].Value)] = kd;
                 value = $"{kd.Keys.ToComma()} keys, {kd.Expires.ToComma()} expires";
             }
             catch (Exception e)
             {
                 var ex = new Exception("Error Pasing " + key + ":" + value + " from redis INFO - Parsed Keys=" + keysMatch.Groups[1].Value + ", Expires=" + keysMatch.Groups[2].Value + ".", e);
                 Current.LogException(ex);
             }  
         }
     }
     base.AddLine(key, value);
 }