parameters: (gallery)
docstring: Restores the metadata cache from the cache file
docstring_summary: Restores the metadata cache from the cache file
docstring_tokens: Restores the metadata cache from the cache file
function: def _restore_cache(gallery):
      """Restores the metadata cache from the cache file"""
      cachePath = os.path.join(gallery.settings["destination"], ".metadata_cache")
      try:
          if os.path.exists(cachePath):
              with open(cachePath, "rb") as cacheFile:
                  gallery.metadataCache = pickle.load(cacheFile)
                  logger.debug("Loaded cache with %d entries", len(gallery.metadataCache))
          else:
              gallery.metadataCache = {}
      except Exception as e:
          logger.warning("Could not load cache: %s", e)
          gallery.metadataCache = {}
function_tokens: def _restore_cache ( gallery ) : cachePath = os . path . join ( gallery . settings [ "destination" ] , ".metadata_cache" ) try : if os . path . exists ( cachePath ) : with open ( cachePath , "rb" ) as cacheFile : gallery . metadataCache = pickle . load ( cacheFile ) logger . debug ( "Loaded cache with %d entries" , len ( gallery . metadataCache ) ) else : gallery . metadataCache = { } except Exception as e : logger . warning ( "Could not load cache: %s" , e ) gallery . metadataCache = { }