Ejemplo n.º 1
0
    def get(self, key: KeyType) -> Future[typing.Optional[ValueType]]:
        """Returns the value for the specified key, or ``None`` if this map
         does not contain this key.

        Warning:
            This method uses ``__hash__`` and ``__eq__`` methods of binary form
            of the key, not the actual implementations of ``__hash__`` and
            ``__eq__`` defined in key's class.

        Args:
            key: The specified key.

        Returns:
            The value associated with the specified key.
        """
        check_not_none(key, "key can't be None")
        try:
            key_data = self._to_data(key)
        except SchemaNotReplicatedError as e:
            return self._send_schema_and_retry(e, self.get, key)

        def handler(message):
            return self._to_object(
                replicated_map_get_codec.decode_response(message))

        request = replicated_map_get_codec.encode_request(self.name, key_data)
        return self._invoke_on_key(request, key_data, handler)
    def get(self, key):
        """
        Returns the value for the specified key, or None if this map does not contain this key.

        **Warning:
        This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode
        and equals defined in the key's class.**

        :param key: (object), the specified key.
        :return: (object), the value associated with the specified key.
        """
        check_not_none(key, "key can't be None")

        def handler(message):
            return self._to_object(
                replicated_map_get_codec.decode_response(message))

        key_data = self._to_data(key)
        request = replicated_map_get_codec.encode_request(self.name, key_data)
        return self._invoke_on_key(request, key_data, handler)
    def get(self, key):
        """Returns the value for the specified key, or ``None`` if this map does not contain this key.

        Warning:
            This method uses ``__hash__`` and ``__eq__`` methods of binary form of the key, not the
            actual implementations of ``__hash__`` and ``__eq__`` defined in key's class.

        Args:
            key: The specified key.

        Returns:
            hazelcast.future.Future[any]: The value associated with the specified key.
        """
        check_not_none(key, "key can't be None")

        def handler(message):
            return self._to_object(replicated_map_get_codec.decode_response(message))

        key_data = self._to_data(key)
        request = replicated_map_get_codec.encode_request(self.name, key_data)
        return self._invoke_on_key(request, key_data, handler)