Beispiel #1
0
        public Task WriteToAsync(RedisSocket socket, bool flush = true)
        {
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }

            Action <Stream> action = (stream) =>
            {
                using (var writer = new RedisStreamWriter(stream, flush))
                {
                    WriteTo(writer);
                }
            };

            return(action.InvokeAsync(socket.GetBufferedStream()));
        }
Beispiel #2
0
        public void WriteTo(Stream stream, bool flush = true)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (!stream.CanWrite)
            {
                throw new ArgumentException("Can not write to closed stream", "stream");
            }

            using (var writer = new RedisStreamWriter(stream, flush))
            {
                WriteTo(writer);
            }
        }
Beispiel #3
0
        public void WriteTo(RedisSocket socket, bool flush = true)
        {
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }

            var stream = socket.GetBufferedStream();

            if (!stream.CanWrite)
            {
                throw new ArgumentException("Can not write to closed stream", "stream");
            }

            using (var writer = new RedisStreamWriter(stream, flush))
            {
                WriteTo(writer);
            }
        }
Beispiel #4
0
        public Task WriteToAsync(Stream stream, bool flush = true)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (!stream.CanWrite)
            {
                throw new ArgumentException("Can not write to closed stream", "stream");
            }

            Action action = () =>
            {
                using (var writer = new RedisStreamWriter(stream, flush))
                {
                    WriteTo(writer);
                }
            };

            return(action.InvokeAsync());
        }