Exemplo n.º 1
0
        /// <summary>
        /// Determines whether this map contains an entry for a key.
        /// </summary>
        /// <param name="keyData">The key.</param>
        /// <param name="cancellationToken">A cancellation token.</param>
        /// <returns>True if the map contains an entry for the specified key; otherwise false.</returns>
        protected virtual async Task <bool> ContainsKeyAsync(IData keyData, CancellationToken cancellationToken)
        {
            var requestMessage  = MapContainsKeyCodec.EncodeRequest(Name, keyData, ContextId);
            var responseMessage = await Cluster.Messaging.SendToKeyPartitionOwnerAsync(requestMessage, keyData, cancellationToken).CAF();

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

            return(response);
        }
        public bool ContainsKey(object key)
        {
            var keyData = ToData(key);

            if (_nearCache != null)
            {
                var cached = _nearCache.Get(keyData);
                if (cached != null)
                {
                    if (cached.Equals(ClientNearCache.NullObject))
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            var request = MapContainsKeyCodec.EncodeRequest(GetName(), keyData, ThreadUtil.GetThreadId());

            return(Invoke(request, keyData, m => MapContainsKeyCodec.DecodeResponse(m).response));
        }
Exemplo n.º 3
0
        protected virtual bool containsKeyInternal(IData keyData)
        {
            var request = MapContainsKeyCodec.EncodeRequest(Name, keyData, GetThreadId());

            return(Invoke(request, keyData, m => MapContainsKeyCodec.DecodeResponse(m).Response));
        }