当前位置: 首页>>代码示例>>C#>>正文


C# BinaryResponse.Read方法代码示例

本文整理汇总了C#中Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.Read方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryResponse.Read方法的具体用法?C# BinaryResponse.Read怎么用?C# BinaryResponse.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse的用法示例。


在下文中一共展示了BinaryResponse.Read方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadResponse

		protected internal override bool ReadResponse(PooledSocket socket)
		{
			this.result = new Dictionary<string, CacheItem>();
			this.Cas = new Dictionary<string, ulong>();

			var response = new BinaryResponse();

			while (response.Read(socket))
			{
				// found the noop, quit
				if (response.CorrelationId == this.noopId)
					return true;

				string key;

				// find the key to the response
				if (!this.idToKey.TryGetValue(response.CorrelationId, out key))
				{
					// we're not supposed to get here tho
					log.WarnFormat("Found response with CorrelationId {0}, but no key is matching it.", response.CorrelationId);
					continue;
				}

				if (log.IsDebugEnabled) log.DebugFormat("Reading item {0}", key);

				// deserialize the response
				int flags = BinaryConverter.DecodeInt32(response.Extra, 0);

				this.result[key] = new CacheItem((ushort)flags, response.Data);
				this.Cas[key] = response.CAS;
			}

			// finished reading but we did not find the NOOP
			return false;
		}
开发者ID:xianrendzw,项目名称:LightFramework.Net,代码行数:35,代码来源:MultiGetOperation.cs

示例2: ReadResponse

		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var serverData = new Dictionary<string, string>();
			var retval = false;

			while (response.Read(socket) && response.KeyLength > 0)
			{
				retval = true;

				var data = response.Data;
				var key = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
				var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

				serverData[key] = value;
			}

			this.result = serverData;
			this.StatusCode = response.StatusCode;

			var result = new BinaryOperationResult()
			{
				StatusCode = StatusCode
			};

			result.PassOrFail(retval, "Failed to read response");
			return result;
		}
开发者ID:javithalion,项目名称:NCache,代码行数:28,代码来源:StatsOperation.cs

示例3: ReadResponse

        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);
            this.Cas = response.CAS;

            return retval & this.ProcessResponse(response);
        }
开发者ID:couchbaselabs,项目名称:EnyimMemcached,代码行数:8,代码来源:BinarySingleItemOperation.cs

示例4: ReadResponse

        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);

            this.StatusCode = StatusCode;

            return retval;
        }
开发者ID:yorkart,项目名称:CachingClient,代码行数:9,代码来源:FlushOperation.cs

示例5: ReadResponse

        protected internal override IOperationResult ReadResponse(IPooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);

            this.StatusCode = StatusCode;
            var result = new BinaryOperationResult()
            {
                Success = retval,
                StatusCode = this.StatusCode
            };

            result.PassOrFail(retval, "Failed to read response");
            return result;
        }
开发者ID:JebteK,项目名称:couchbase-net-client,代码行数:15,代码来源:FlushOperation.cs

示例6: ReadResponse

		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();

			var retval = response.Read(socket);

			this.StatusCode = response.StatusCode;
			this.Data = response.Data.Array;

			var result = new BinaryOperationResult
			{
				StatusCode = this.StatusCode
			};

			result.PassOrFail(retval, "Failed to read response");
			return result;
		}
开发者ID:javithalion,项目名称:NCache,代码行数:17,代码来源:SaslStep.cs

示例7: ReadResponse

		protected internal override bool ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var serverData = new Dictionary<string, string>();
			var retval = false;

			while (response.Read(socket) && response.KeyLength > 0)
			{
				retval = true;

				var data = response.Data;
				var key = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
				var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

				serverData[key] = value;
			}

			this.result = serverData;

			return retval;
		}
开发者ID:xianrendzw,项目名称:LightFramework.Net,代码行数:21,代码来源:StatsOperation.cs

示例8: ReadResponse

		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var retval = response.Read(socket);
			
			this.Cas = response.CAS;
			this.StatusCode = response.StatusCode;

			var result = new BinaryOperationResult()
			{
				Success = retval,
				Cas = this.Cas,
				StatusCode = this.StatusCode
			};

			IOperationResult responseResult;
			if (! (responseResult = this.ProcessResponse(response)).Success)
			{
				result.InnerResult = responseResult;
				responseResult.Combine(result);
			}
			
			return result;
		}
开发者ID:javithalion,项目名称:NCache,代码行数:24,代码来源:BinarySingleItemOperation.cs

示例9: ReadResponse

        protected override IOperationResult ReadResponse(IPooledSocket socket)
        {
            var response = new BinaryResponse();
            var result = new BinaryOperationResult();

            if (response.Read(socket))
            {
                this.Result = DecodeResult(response.Data);

                result.Pass();
                return result;
            }

            result.Fail("Processing of response failed");
            return result;
        }
开发者ID:JebteK,项目名称:couchbase-net-client,代码行数:16,代码来源:SyncOperation.cs

示例10: ReadResponse

        protected override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            if (response.Read(socket))
            {
                this.Result = DecodeResult(response.Data);

                return true;
            }

            return false;
        }
开发者ID:e-travel,项目名称:EnyimMemcached,代码行数:12,代码来源:SyncOperation.cs

示例11: ReadResponse

        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();

            return response.Read(socket);
        }
开发者ID:simonthorogood,项目名称:EnyimMemcached,代码行数:6,代码来源:FlushOperation.cs


注:本文中的Enyim.Caching.Memcached.Protocol.Binary.BinaryResponse.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。