diff --git a/source/net/filebot/Cache.java b/source/net/filebot/Cache.java index 603a60f4..50aa9b0f 100644 --- a/source/net/filebot/Cache.java +++ b/source/net/filebot/Cache.java @@ -22,7 +22,7 @@ public class Cache { public static final Duration ONE_MONTH = Duration.ofDays(30); public static Cache getCache(String name, CacheType type) { - return CacheManager.getInstance().getCache(name, type); + return CacheManager.getInstance().getCache(name.toLowerCase() + "_" + type.ordinal(), type); } public CachedResource bytes(T key, Transform resource) { diff --git a/source/net/filebot/CacheManager.java b/source/net/filebot/CacheManager.java index d440190e..62cfdf2b 100644 --- a/source/net/filebot/CacheManager.java +++ b/source/net/filebot/CacheManager.java @@ -36,12 +36,11 @@ public class CacheManager { } public synchronized Cache getCache(String name, CacheType type) { - String cacheName = name.toLowerCase() + "_" + type.ordinal(); - if (!manager.cacheExists(cacheName)) { - debug.config("Create cache: " + cacheName); - manager.addCache(new net.sf.ehcache.Cache(type.getConfiguration(cacheName))); + if (!manager.cacheExists(name)) { + debug.config("Create cache: " + name); + manager.addCache(new net.sf.ehcache.Cache(type.getConfiguration(name))); } - return new Cache(manager.getCache(cacheName)); + return new Cache(manager.getCache(name)); } public synchronized void clearAll() { diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 7992a822..043f4d4c 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -447,7 +447,7 @@ public class MediaBindingBean { // calculate checksum from file Cache cache = Cache.getCache("crc32", CacheType.Ephemeral); - return (String) cache.computeIfAbsent(inferredMediaFile, element -> crc32(inferredMediaFile)); + return (String) cache.computeIfAbsent(inferredMediaFile.getCanonicalPath(), it -> crc32(inferredMediaFile)); } @Define("fn")