def add_provider(self, provider, cache, name=None):
        """Registers a provider on the container.

        :param provider:
            Anything that's callable and expects exactly one argument, the
            :class:`Container` object.
        :param cache:
            Whether to cache the return value of the provider.
        :param name:
            Alternative name of the provider.
            Default: name of the callable.
        """
        register_as = name or provider.__name__
        self[register_as] = FunctionCache(provider) if cache else provider