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;
            }
        }
		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) { }
		public static Task<bool> ConcateAsync(this ISimpleMemcachedClient self, ConcatenationMode mode, string key, byte[] data)
		{
			return self.ConcateAsync(mode, key, new ArraySegment<byte>(data));
		}
Beispiel #10
0
		public static bool Concate(this ISimpleMemcachedClient self, ConcatenationMode mode, string key, ArraySegment<byte> data)
		{
			return self.ConcateAsync(mode, key, data).RunAndUnwrap();
		}
Beispiel #11
0
 void IPerformanceMonitor.Concatenate(ConcatenationMode mode, int amount, bool success)
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
 public ConcatOperation(ConcatenationMode mode, string key, ArraySegment <byte> data)
     : base(key)
 {
     this.data = data;
     this.mode = mode;
 }
Beispiel #13
0
 public VBConcat(VBucketNodeLocator locator, ConcatenationMode mode, string key, ArraySegment <byte> data)
     : base(mode, key, data)
 {
     this.locator = locator;
 }
Beispiel #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();
		}
Beispiel #15
0
		public IConcatOperation Concat(ConcatenationMode mode, Key key, ArraySegment<byte> data, ulong cas)
		{
			throw new NotImplementedException();
		}
Beispiel #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);
		}
        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;
		}
Beispiel #19
0
 public Task <bool> ConcateAsync(ConcatenationMode mode, string key, ArraySegment <byte> data)
 {
     return(HandleErrors(PerformConcate(mode, key, 0, data)));
 }