class CacheStorageFiles {

  Path getImageDirectory(ImageReference imageReference) {
    // Replace ':' and '@' with '!' to avoid directory-naming restrictions
    String replacedReference =
        imageReference.toStringWithQualifier().replace(':', '!').replace('@', '!');

    // Split image reference on '/' to build directory structure
    Iterable<String> directories = Splitter.on('/').split(replacedReference);
    Path destination = getImagesDirectory();
    for (String dir : directories) {
      destination = destination.resolve(dir);
    }
    return destination;
  }

    CacheStorageFiles(Path cacheDirectory);

}