示例#1
0
        protected virtual bool RemoveInternal(IData keyData, object value)
        {
            var valueData     = ToData(value);
            var request       = MapRemoveIfSameCodec.EncodeRequest(Name, keyData, valueData, GetThreadId());
            var clientMessage = Invoke(request, keyData);

            return(MapRemoveIfSameCodec.DecodeResponse(clientMessage).Response);
        }
        /// <summary>
        /// Removes an entry from this map.
        /// </summary>
        /// <param name="keyData">The key.</param>
        /// <param name="valueData">The value.</param>
        /// <param name="cancellationToken">A cancellation token.</param>
        /// <returns>The value, if any, or default(TValue).</returns>
        /// <remarks>
        /// <para>This method removes an entry if the key and the value both match the
        /// specified key and value.</para>
        /// </remarks>
        protected virtual async Task <bool> RemoveAsync(IData keyData, IData valueData, CancellationToken cancellationToken)
        {
            var requestMessage  = MapRemoveIfSameCodec.EncodeRequest(Name, keyData, valueData, ContextId);
            var responseMessage = await Cluster.Messaging.SendToKeyPartitionOwnerAsync(requestMessage, keyData, cancellationToken).CAF();

            var response = MapRemoveIfSameCodec.DecodeResponse(responseMessage).Response;

            return(response);
        }
        public bool Remove(object key, object value)
        {
            var keyData   = ToData(key);
            var valueData = ToData(value);
            var request   = MapRemoveIfSameCodec.EncodeRequest(GetName(), keyData, valueData, ThreadUtil.GetThreadId());

            InvalidateNearCacheEntry(keyData);
            var clientMessage = Invoke(request, keyData);

            return(MapRemoveIfSameCodec.DecodeResponse(clientMessage).response);
        }