IsMatch() public méthode

public IsMatch ( byte expected ) : bool
expected byte
Résultat bool
Exemple #1
0
        internal override void ProcessCallbacks(object ctx, RedisResult result)
        {
            RedisResult[] subItems;
            if (!result.IsError && (subItems = result.ValueItems) != null)
            {
                switch (subItems.Length)
                {
                case 3:
                    RedisResult msgType = subItems[0];
                    if (msgType.IsMatch(message))
                    {
                        string key = subItems[1].ValueString;
                        OnMessageReceived(key, key, subItems[2]);
                    }
                    else if (msgType.IsMatch(subscribe) || msgType.IsMatch(unsubscribe) ||
                             msgType.IsMatch(psubscribe) || msgType.IsMatch(punsubscribe))
                    {
                        var newCount = (int)subItems[2].ValueInt64;
                        Interlocked.Exchange(ref subscriptionCount, newCount);
                    }
                    break;

                case 4:
                    if (subItems[0].IsMatch(pmessage))
                    {
                        OnMessageReceived(subItems[1].ValueString, subItems[2].ValueString, subItems[3]);
                    }
                    break;
                }
            }
        }
Exemple #2
0
        internal override object ProcessReply(ref RedisResult result, RedisMessage message)
        {
            byte[] expected;
            if (!result.IsError && (expected = message.Expected) != null)
            {
                result = result.IsMatch(expected)
                             ? RedisResult.Pass
                             : RedisResult.Error(result.ValueString);
            }


            if (result.IsError && message.MustSucceed)
            {
                throw new RedisException("A critical operation failed: " + message);
            }
            return(message);
        }
        internal override object ProcessReply(ref RedisResult result, RedisMessage message)
        {
            byte[] expected;
            if (!result.IsError && (expected = message.Expected) != null)
            {
                result = result.IsMatch(expected)
                ? RedisResult.Pass : RedisResult.Error(result.ValueString);
            }

            if (result.IsError && message.MustSucceed)
            {
                throw new RedisException("A critical operation failed: " + message.ToString());
            }
            return message;
        }