* minor refactoring

This commit is contained in:
Reinhard Pointner 2015-11-14 16:12:03 +00:00
parent 0474d73c97
commit 6c1109ced1
3 changed files with 7 additions and 5 deletions

View File

@ -75,9 +75,9 @@
/>
<!--
Simple memory cache for calculated checksums. Time to live is 2 hours.
Simple memory cache. Time to live is 2 hours.
-->
<cache name="checksum"
<cache name="ephemeral"
maxElementsInMemory="50000"
eternal="false"
timeToIdleSeconds="7200"

View File

@ -10,6 +10,8 @@ import net.sf.ehcache.Element;
public class Cache {
public static final String EPHEMERAL = "ephemeral";
public static Cache getCache(String name) {
return new Cache(CacheManager.getInstance().getCache(name));
}

View File

@ -628,8 +628,8 @@ public class MediaBindingBean {
}
@Define("bitrate")
public Float getBitRate() {
return new Float(getMediaInfo(StreamKind.General, 0, "OverallBitRate"));
public Long getBitRate() {
return new Double(getMediaInfo(StreamKind.General, 0, "OverallBitRate")).longValue();
}
@Define("duration")
@ -956,7 +956,7 @@ public class MediaBindingBean {
private String crc32(File file) throws IOException, InterruptedException {
// try to get checksum from cache
Cache cache = Cache.getCache("checksum");
Cache cache = Cache.getCache(Cache.EPHEMERAL);
String hash = cache.get(file, String.class);
if (hash != null) {