Load a build cache, updating it if necessary.

    A cache is considered outdated if any of its inputs have changed.

    Arguments
    force -- Consider a cache outdated regardless of whether its inputs have
             been modified.

def update_cache(force=False, cache_file=None):
    """
    Load a build cache, updating it if necessary.

    A cache is considered outdated if any of its inputs have changed.

    Arguments
    force -- Consider a cache outdated regardless of whether its inputs have
             been modified.
    """
    if not cache_file:
        cache_file = find_config()
    cache_config = devpipeline_configure.parser.read_config(cache_file)
    cache = devpipeline_configure.cache._CachedConfig(cache_config, cache_file)
    if force or _is_outdated(cache_file, cache):
        cache = devpipeline_configure.config.process_config(
            cache_config.get("DEFAULT", "dp.build_config"),
            os.path.dirname(cache_file),
            "build.cache",
            profiles=cache_config.get("DEFAULT", "dp.profile_name", fallback=None),
            overrides=cache_config.get("DEFAULT", "dp.overrides", fallback=None),
        )
        devpipeline_core.sanitizer.sanitize(
            cache, lambda n, m: print("{} [{}]".format(m, n))
        )
    return cache