1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-10 14:31:04 -04:00
This commit is contained in:
Reinhard Pointner 2016-03-09 06:28:36 +00:00
parent 9fe2c81784
commit 3ea3045545
3 changed files with 6 additions and 7 deletions

View File

@ -22,7 +22,7 @@ public class Cache {
public static final Duration ONE_MONTH = Duration.ofDays(30); public static final Duration ONE_MONTH = Duration.ofDays(30);
public static Cache getCache(String name, CacheType type) { public static Cache getCache(String name, CacheType type) {
return CacheManager.getInstance().getCache(name, type); return CacheManager.getInstance().getCache(name.toLowerCase() + "_" + type.ordinal(), type);
} }
public <T> CachedResource<T, byte[]> bytes(T key, Transform<T, URL> resource) { public <T> CachedResource<T, byte[]> bytes(T key, Transform<T, URL> resource) {

View File

@ -36,12 +36,11 @@ public class CacheManager {
} }
public synchronized Cache getCache(String name, CacheType type) { public synchronized Cache getCache(String name, CacheType type) {
String cacheName = name.toLowerCase() + "_" + type.ordinal(); if (!manager.cacheExists(name)) {
if (!manager.cacheExists(cacheName)) { debug.config("Create cache: " + name);
debug.config("Create cache: " + cacheName); manager.addCache(new net.sf.ehcache.Cache(type.getConfiguration(name)));
manager.addCache(new net.sf.ehcache.Cache(type.getConfiguration(cacheName)));
} }
return new Cache(manager.getCache(cacheName)); return new Cache(manager.getCache(name));
} }
public synchronized void clearAll() { public synchronized void clearAll() {

View File

@ -447,7 +447,7 @@ public class MediaBindingBean {
// calculate checksum from file // calculate checksum from file
Cache cache = Cache.getCache("crc32", CacheType.Ephemeral); 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") @Define("fn")