protected internal override IOperationResult ReadResponse(IPooledSocket socket) { var retval = new Dictionary <string, CacheItem>(); var cas = new Dictionary <string, ulong>(); try { GetResponse r; while ((r = GetHelper.ReadItem(socket)) != null) { var key = r.Key; retval[key] = r.Item; cas[key] = r.CasValue; } } catch (NotSupportedException) { throw; } catch (Exception e) { log.Error(e); } this.result = retval; this.Cas = cas; return(new TextOperationResult().Pass()); }
protected internal override ValueTask <IOperationResult> ReadResponseAsync(PooledSocket socket) { GetResponse r = GetHelper.ReadItem(socket); var result = new TextOperationResult(); if (r == null) { return(new ValueTask <IOperationResult>(result.Fail("Failed to read response"))); } this.result = r.Item; this.Cas = r.CasValue; GetHelper.FinishCurrent(socket); return(new ValueTask <IOperationResult>(result.Pass())); }
protected internal override IOperationResult ReadResponse(PooledSocket socket) { var response = GetHelper.ReadItem(socket); var result = new TextOperationResult(); if (response == null) { return(result.Fail("Failed to read response")); } this.result = response.Item; this.Cas = response.CasValue; GetHelper.FinishCurrent(socket); return(result.Pass()); }
protected internal override async Task <IOperationResult> ReadResponseAsync(PooledSocket socket, CancellationToken cancellationToken = default(CancellationToken)) { var response = await GetHelper.ReadItemAsync(socket, cancellationToken).ConfigureAwait(false); var result = new TextOperationResult(); if (response == null) { return(result.Fail("Failed to read response")); } this.result = response.Item; this.Cas = response.CasValue; await GetHelper.FinishCurrentAsync(socket, cancellationToken).ConfigureAwait(false); return(result.Pass()); }