* minor refactoring
This commit is contained in:
parent
0474d73c97
commit
6c1109ced1
|
@ -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"
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue