protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
            {
                switch (result.Type)
                {
                case ResultType.Integer:
                    long i64;
                    if (result.TryGetInt64(out i64))
                    {
                        SetResult(message, i64);
                        return(true);
                    }
                    break;

                case ResultType.SimpleString:
                case ResultType.BulkString:
                    double val;
                    if (result.TryGetDouble(out val))
                    {
                        SetResult(message, val);
                        return(true);
                    }
                    break;
                }
                return(false);
            }
 public bool TryParse(RawResult result, out TimeSpan?expiry)
 {
     switch (result.Type)
     {
     case ResultType.Integer:
         long time;
         if (result.TryGetInt64(out time))
         {
             if (time < 0)
             {
                 expiry = null;
             }
             else if (isMilliseconds)
             {
                 expiry = TimeSpan.FromMilliseconds(time);
             }
             else
             {
                 expiry = TimeSpan.FromSeconds(time);
             }
             return(true);
         }
         break;
     }
     expiry = null;
     return(false);
 }
            protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
            {
                long unixTime, micros;

                switch (result.Type)
                {
                case ResultType.Integer:
                    if (result.TryGetInt64(out unixTime))
                    {
                        var time = RedisBase.UnixEpoch.AddSeconds(unixTime);
                        SetResult(message, time);
                        return(true);
                    }
                    break;

                case ResultType.MultiBulk:
                    var arr = result.GetItems();
                    switch (arr.Length)
                    {
                    case 1:
                        if (arr[0].TryGetInt64(out unixTime))
                        {
                            var time = RedisBase.UnixEpoch.AddSeconds(unixTime);
                            SetResult(message, time);
                            return(true);
                        }
                        break;

                    case 2:
                        if (arr[0].TryGetInt64(out unixTime) && arr[1].TryGetInt64(out micros))
                        {
                            var time = RedisBase.UnixEpoch.AddSeconds(unixTime).AddTicks(micros * 10);         // datetime ticks are 100ns
                            SetResult(message, time);
                            return(true);
                        }
                        break;
                    }
                    break;
                }
                return(false);
            }