Exemple #1
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;

            if (status == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas    = response.CAS;

#if EVEN_MORE_LOGGING
                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("Get succeeded for key '{0}'.", this.Key);
                }
#endif

                return(result.Pass());
            }

            this.Cas = 0;

#if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
            }
#endif

            var message = ResultHelper.ProcessResponseData(response.Data);
            return(result.Fail(message));
        }
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;
            if (status == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas    = response.CAS;

                return(result.Pass());
            }

            this.Cas = 0;
            return(result.Fail(OperationResultHelper.ProcessResponseData(response.Data)));
        }