fileInfo = cachedFiles.getIfPresent(source);
if (fileInfo == null || !fileInfo.cachedFile.exists()) {
// TODO - use the hashing service for this
long lastModified = source.lastModified();
long length = source.length();
HashValue hashValue = HashUtil.createHash(source, "sha1");
fileInfo = copyIntoCache(baseDirFactory, source, lastModified, length, hashValue);
} else {
// TODO - use the change detection service for this
long lastModified = source.lastModified();
long length = source.length();
if (lastModified != fileInfo.lastModified || length != fileInfo.length) {
HashValue hashValue = HashUtil.createHash(source, "sha1");
if (!hashValue.equals(fileInfo.hashValue)) {
fileInfo = copyIntoCache(baseDirFactory, source, lastModified, length, hashValue);
}
}
}
} finally {