コード例 #1
0
        public async ValueTask <bool> Ping()
        {
            Commands.PING ping   = new Commands.PING(null);
            var           result = await Execute(ping, typeof(string));

            if (result.IsError)
            {
                throw new RedisException(result.Messge);
            }
            return(true);
        }
コード例 #2
0
ファイル: RedisHost.cs プロジェクト: zakailynn/BeetleX.Redis
 public async void Ping()
 {
     if (System.Threading.Interlocked.CompareExchange(ref mPingStatus, 1, 0) == 0)
     {
         try
         {
             Connect(mPingClient);
             Commands.PING ping    = new Commands.PING(null);
             var           request = new RedisRequest(null, mPingClient, ping, typeof(string));
             var           result  = await request.Execute();
         }
         catch
         {
         }
         finally
         {
             System.Threading.Interlocked.Exchange(ref mPingStatus, 0);
         }
     }
 }