예제 #1
0
        private async Task ReceiveAsync()
        {
            _diagnosticSource.LogEvent("ReceiveStart");
            if (_pipelineException != null)
            {
                ThrowErrorForRemainingResponseQueueItems();
                return;
            }

            RedisPipelineItem currentItem = null;

            try
            {
                while (_responseQueue.TryDequeue(out currentItem))
                {
                    _diagnosticSource.LogEvent("ReceiveItemStart", currentItem);
                    await _redisReader.ReadAsync(currentItem).ConfigureAwait(false);

                    _diagnosticSource.LogEvent("ReceiveItemStop", currentItem);
                }
            }
            catch (Exception error)
            {
                _pipelineException = error;
                ThrowErrorForRemainingResponseQueueItems();
                currentItem?.OnError(error);
                _diagnosticSource.LogEvent("ReceiveException", error);
            }
            finally
            {
                _redisReader.CheckInBuffers();
            }

            _diagnosticSource.LogEvent("ReceiveStop");
            _lastCommandTicks = Environment.TickCount;
        }
예제 #2
0
        private async Task <TItem> GetAsyncInternal(TKey key, TimeSpan?resetExpiryTimeSpan)
        {
            var connection = await GetKeyspacedDatabaseAsync().ConfigureAwait(false);

            return(await _redisReader.ReadAsync(connection, key, resetExpiryTimeSpan).ConfigureAwait(false));
        }