public static Cache withDirectory(Path cacheDirectory) throws CacheDirectoryCreationException {
    try {
      Files.createDirectories(cacheDirectory);
    } catch (IOException ex) {
      throw new CacheDirectoryCreationException(ex);
    }
    return new Cache(new CacheStorageFiles(cacheDirectory));
  }
Initializes the cache using {@code cacheDirectory} for storage.

@param cacheDirectory the directory for the cache. Creates the directory if it does not exist.
@return a new {@link Cache}
@throws CacheDirectoryCreationException if an I/O exception occurs when creating cache
    directory
jib-core/src/main/java/com/google/cloud/tools/jib/cache/Cache.java