internal ConcateOperation(ConcatenationMode mode, string key, ArraySegment<byte> data)
			: base(mode == ConcatenationMode.Append
					? StoreCommand.Append
					: StoreCommand.Prepend, key, new CacheItem() { Data = data, Flags = 0 }, 0, 0)
		{
			this.mode = mode;
		}
		public IConcatOperation Concat(ConcatenationMode mode, Key key, ArraySegment<byte> data, ulong cas)
		{
			return new ConcatOperation(allocator, mode, key)
			{
				Cas = cas,
				Data = data
			};
		}
        void IPerformanceMonitor.Concatenate(ConcatenationMode mode, int amount, bool success)
        {
            switch (mode) {
                case ConcatenationMode.Append:
                    this.pcAppend.Increment(amount, success);
                    break;

                case ConcatenationMode.Prepend:
                    this.pcPrepend.Increment(amount, success);
                    break;
            }
        }
Example #4
0
		public static Task<IOperationResult> ConcateAsync(this IMemcachedClient self, ConcatenationMode mode, string key, byte[] data, ulong cas = Protocol.NO_CAS)
		{
			return self.ConcateAsync(mode, key, new ArraySegment<byte>(data), cas);
		}
 IConcatOperation IOperationFactory.Concat(ConcatenationMode mode, string key, ulong cas, ArraySegment<byte> data)
 {
     return new ConcatOperation(mode, key, data) { Cas = cas };
 }
 public VBConcat(VBucketNodeLocator locator, ConcatenationMode mode, string key, ArraySegment<byte> data)
     : base(mode, key, data)
 {
     this.locator = locator;
 }
		IConcatOperation IOperationFactory.Concat(ConcatenationMode mode, string key, ulong cas, ArraySegment<byte> data)
		{
			if (cas > 0) throw new NotSupportedException("Text protocol does not support " + mode + " with cas.");

			return new ConcateOperation(mode, key, data);
		}
		public void Concatenate(ConcatenationMode mode, int amount, bool success) { }
Example #9
0
		public static Task<bool> ConcateAsync(this ISimpleMemcachedClient self, ConcatenationMode mode, string key, byte[] data)
		{
			return self.ConcateAsync(mode, key, new ArraySegment<byte>(data));
		}
Example #10
0
		public static bool Concate(this ISimpleMemcachedClient self, ConcatenationMode mode, string key, ArraySegment<byte> data)
		{
			return self.ConcateAsync(mode, key, data).RunAndUnwrap();
		}
Example #11
0
 void IPerformanceMonitor.Concatenate(ConcatenationMode mode, int amount, bool success)
 {
     throw new NotImplementedException();
 }
Example #12
0
 public ConcatOperation(ConcatenationMode mode, string key, ArraySegment <byte> data)
     : base(key)
 {
     this.data = data;
     this.mode = mode;
 }
Example #13
0
 public VBConcat(VBucketNodeLocator locator, ConcatenationMode mode, string key, ArraySegment <byte> data)
     : base(mode, key, data)
 {
     this.locator = locator;
 }
Example #14
0
		public static IOperationResult Concate(this IMemcachedClient self, ConcatenationMode mode, string key, ArraySegment<byte> data, ulong cas = Protocol.NO_CAS)
		{
			return self.ConcateAsync(mode, key, data, cas).RunAndUnwrap();
		}
Example #15
0
		public IConcatOperation Concat(ConcatenationMode mode, Key key, ArraySegment<byte> data, ulong cas)
		{
			throw new NotImplementedException();
		}
Example #16
0
		public static Task<IOperationResult> ConcateAsync(this IMemcachedClient self, ConcatenationMode mode, string key, ArraySegment<byte> data)
		{
			return self.ConcateAsync(mode, key, data, Protocol.NO_CAS);
		}
Example #17
0
        protected override bool PerformConcatenate(ConcatenationMode mode, string key, ref ulong cas, ArraySegment<byte> data)
        {
            var hashedKey = this.KeyTransformer.Transform(key);
            var node = this.Pool.Locate(hashedKey);

            if (node != null)
            {
                var command = this.Pool.OperationFactory.Concat(mode, hashedKey, 0, data);
                var retval = this.ExecuteWithRedirect(node, command);

                cas = command.CasValue;
                if (this.PerformanceMonitor != null) this.PerformanceMonitor.Concatenate(mode, 1, true);

                return retval;
            }

            if (this.PerformanceMonitor != null) this.PerformanceMonitor.Concatenate(mode, 1, false);

            return false;
        }
		public ConcatOperation(ConcatenationMode mode, string key, ArraySegment<byte> data)
			: base(key)
		{
			this.data = data;
			this.mode = mode;
		}
Example #19
0
 public Task <bool> ConcateAsync(ConcatenationMode mode, string key, ArraySegment <byte> data)
 {
     return(HandleErrors(PerformConcate(mode, key, 0, data)));
 }