• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Binary.BinaryResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



BinaryResponse类属于Enyim.Caching.Memcached.Protocol.Binary命名空间,在下文中一共展示了BinaryResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: ProcessResponse

        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 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 true;
            }

            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

            return false;
        }
开发者ID:simonthorogood,项目名称:EnyimMemcached,代码行数:25,代码来源:GetOperation.cs


示例3: ProcessResponse

        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);
        }
开发者ID:JebteK,项目名称:couchbase-net-client,代码行数:31,代码来源:GetOperation.cs


示例4: 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


示例5: 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


示例6: 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


示例7: ProcessResponse

        protected override bool ProcessResponse(BinaryResponse response)
        {
            var r = base.ProcessResponse(response);

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
                return false;

            return r;
        }
开发者ID:dineshkummarc,项目名称:couchbase-net-client,代码行数:10,代码来源:GetAndTouchOperation.cs


示例8: ProcessResponse

		protected override bool ProcessResponse(BinaryResponse response)
		{
#if EVEN_MORE_LOGGING
			if (log.IsDebugEnabled)
				if (response.StatusCode == 0)
					log.DebugFormat("Delete succeeded for key '{0}'.", this.Key);
				else
					log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
#endif

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


示例9: ReadResponseAsync

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

			this.currentSocket = socket;
			this.asyncReader = new BinaryResponse();
			this.asyncLoopState = null;
			this.afterAsyncRead = next;

			return this.DoReadAsync();
		}
开发者ID:623442733,项目名称:EnyimMemcached,代码行数:12,代码来源:MultiGetOperation.cs


示例10: ProcessResponse

        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var r = base.ProcessResponse(response);
            var result = new BinaryOperationResult();

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
            {
                return result.Fail("Failed to process response");
            }

            return r;
        }
开发者ID:sfoutrier,项目名称:couchbase-net-client,代码行数:13,代码来源:GetAndTouchOperation.cs


示例11: ProcessResponse

        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var r = response.StatusCode == 0;
            var result = new BinaryOperationResult();

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
            {
                return result.Fail("Process response failed");
            }

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


示例12: ProcessResponse

        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 0)
            {
                var data = response.Data;
                if (data.Count != 8)
                    throw new InvalidOperationException("result must be 8 bytes long, received: " + data.Count);

                this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);

                return true;
            }

            return false;
        }
开发者ID:sneal,项目名称:EnyimMemcached,代码行数:15,代码来源:MutatorOperation.cs


示例13: 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


示例14: 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


示例15: ProcessResponse

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

            this.StatusCode = status;

            if (status == 0)
            {
                this.Cas = response.CAS;
                return result.Pass();
            }

            this.Cas = 0;
            var message = ResultHelper.ProcessResponseData(response.Data);
            return result.Fail(message);
        }
开发者ID:FOXITES,项目名称:couchbase-net-client,代码行数:17,代码来源:UnlockOperation.cs


示例16: ProcessResponse

 protected override IOperationResult ProcessResponse(BinaryResponse response)
 {
     var result = new BinaryOperationResult();
     #if EVEN_MORE_LOGGING
     if (log.IsDebugEnabled)
         if (response.StatusCode == 0)
             log.DebugFormat("Delete succeeded for key '{0}'.", this.Key);
         else
             log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
     #endif
     if (response.StatusCode == 0)
     {
         return result.Pass();
     }
     else
     {
         var message = ResultHelper.ProcessResponseData("Delete failed for key " + Key, response.Data);
         return result.Fail(message);
     }
 }
开发者ID:schwab,项目名称:EnyimMemcached,代码行数:20,代码来源:DeleteOperation.cs


示例17: ProcessResponse

        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();
            var status = response.StatusCode;
            this.StatusCode = status;

            if (status == 0)
            {
                var data = response.Data;
                if (data.Count != 8)
                    return result.Fail("Result must be 8 bytes long, received: " + data.Count, new InvalidOperationException());

                this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);

                return result.Pass();
            }

            var message = ResultHelper.ProcessResponseData("Mutate failed for key " + Key, response.Data);
            return result.Fail(message);
        }
开发者ID:schwab,项目名称:EnyimMemcached,代码行数:20,代码来源:MutatorOperation.cs


示例18: 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


示例19: 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


示例20: ProcessResponse

		protected override bool ProcessResponse(BinaryResponse response)
		{
			return true;
		}
开发者ID:xianrendzw,项目名称:LightFramework.Net,代码行数:4,代码来源:ConcatOperation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EpgTimer.ReserveData类代码示例发布时间:2022-05-24
下一篇:
C# Interfaces.esTransactionScope类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap