Пример #1
0
        public RedisResult <RedisServerInfo> Info(RedisParam?section = null)
        {
            string lines;

            if (!section.HasValue || section.Value.IsNull)
            {
                lines = ExpectBulkString(RedisCommandList.Info);
            }
            else
            {
                lines = ExpectBulkString(RedisCommandList.Info, section);
            }

            var info = RedisServerInfo.Parse(lines);

            return(new RedisResult <RedisServerInfo>(info));
        }
Пример #2
0
 public RedisServerInfo GetServerInfo()
 {
     try
     {
         var socket = GetSocket();
         if (socket.IsConnected())
         {
             using (var cmd = new RedisCommand(-1, RedisCommandList.Info, RedisCommandType.SendAndReceive))
             {
                 string lines = cmd.ExpectBulkString(new RedisSocketContext(socket, Settings), true);
                 return(RedisServerInfo.Parse(lines));
             }
         }
     }
     catch (Exception)
     { }
     return(null);
 }