Exemple #1
0
            Task <RedisResult> ReadNext(long cursor, bool running)
            {
                if (cursor == 0 && running)
                {
                    return(null);                        // end of the line
                }
                var          pending = new TaskCompletionSource <RedisResult>();
                RedisMessage msg;

                if (key == null)
                {
                    msg = (string.IsNullOrEmpty(pattern) || pattern == "*") ? RedisMessage.Create(db, command, cursor, RedisLiteral.COUNT, 100)
                        : RedisMessage.Create(db, command, cursor, RedisLiteral.MATCH, pattern, RedisLiteral.COUNT, 100);
                }
                else
                {
                    msg = (string.IsNullOrEmpty(pattern) || pattern == "*") ? RedisMessage.Create(db, command, key, cursor, RedisLiteral.COUNT, 100)
                        : RedisMessage.Create(db, command, key, cursor, RedisLiteral.MATCH, pattern, RedisLiteral.COUNT, 100);
                }
                connection.ExecuteRaw(msg, false, pending).ContinueWith(scanContinuation);
                return(pending.Task);
            }