Exemple #1
0
        public static MovedResponse From(IRedisResponse response)
        {
            if (response.IsError == false)
                return null;

            var parts = response.Value.ToString().Split(' ');

            if (parts[0] != "MOVED")
                return null;

            if (parts.Length < 3)
                throw ExceptionBecause.MalformedData.InMovedKeyInfo(response);

            var hostAndPort = parts[2].Split(':');

            return new MovedResponse
            {
                MovedSlot = HashSlot.ParseSlotNumber(parts[1]),
                NewHost = hostAndPort[0],
                NewPort = int.Parse(hostAndPort[1])
            };
        }
 public static Exception InClusterInfo(IRedisResponse clusterInfoResponse)
 {
     return new Exception("Unexpected response to CLUSTER NODES: " + clusterInfoResponse.Value);
 }
 public static Exception FailedToAuthenticate(IRedisResponse response)
 {
     return new Exception("Could not authenticate. Response was: " + response.Value);
 }
 public static Exception GotErrorResponseFromClusterInfo(IRedisResponse clusterInfoResponse)
 {
     return new Exception(clusterInfoResponse.Value.ToString());
 }
 public static Exception InMovedKeyInfo(IRedisResponse response)
 {
     return new Exception("Cannot process moved response");
 }
 public static Exception InNodeInfo(string host, int port, IRedisResponse response)
 {
     return new Exception("Unexpected response from info command");
 }
 public ClusterInfoResponse(IRedisResponse redisResponse)
 {
     _response = redisResponse;
 }
Exemple #8
0
 private static void Write(IRedisResponse response)
 {
     if (response.IsError)
         Console.WriteLine("ERR:\r\n{0}\r\n", response.Value);
 }