def METHOD_NAME(settings, tmpdir):
    settings["destination"] = str(tmpdir)
    gal1 = Gallery(settings, ncpu=1)
    gal2 = Gallery(settings, ncpu=1)
    extended_caching.save_cache(gal1)
    extended_caching._restore_cache(gal2)
    assert gal1.metadataCache == gal2.metadataCache
    # test bad cache
    cachePath = os.path.join(settings["destination"], ".metadata_cache")
    with open(cachePath, "w") as f:
        f.write("bad pickle file")
    extended_caching._restore_cache(gal2)
    assert gal2.metadataCache == {}