* increase cache intervals
This commit is contained in:
parent
2bf9f96ea1
commit
5eb3e73120
|
@ -47,14 +47,14 @@
|
|||
/>
|
||||
|
||||
<!--
|
||||
Very long-lived cache (2 months) anime/series lists, movie index, etc
|
||||
Very long-lived cache (4 months) anime/series lists, movie index, etc
|
||||
-->
|
||||
<cache name="web-persistent-datasource"
|
||||
maxElementsInMemory="50"
|
||||
maxElementsOnDisk="50000"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="5259000"
|
||||
timeToLiveSeconds="5259000"
|
||||
timeToIdleSeconds="10512000"
|
||||
timeToLiveSeconds="10512000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="true"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
|
|
|
@ -286,7 +286,7 @@ public class Main {
|
|||
* Show update notifications if updates are available
|
||||
*/
|
||||
private static void checkUpdate() throws Exception {
|
||||
final Properties updateProperties = new CachedResource<Properties>(getApplicationProperty("update.url"), Properties.class, 24 * 60 * 60 * 1000, 0, 0) {
|
||||
final Properties updateProperties = new CachedResource<Properties>(getApplicationProperty("update.url"), Properties.class, CachedResource.ONE_DAY, 0, 0) {
|
||||
|
||||
@Override
|
||||
public Properties process(ByteBuffer data) {
|
||||
|
|
|
@ -228,7 +228,7 @@ public class ArgumentProcessor {
|
|||
}
|
||||
|
||||
// fetch remote script only if modified
|
||||
CachedResource<String> script = new CachedResource<String>(url, String.class, 24 * 60 * 60 * 1000) {
|
||||
CachedResource<String> script = new CachedResource<String>(url, String.class, CachedResource.ONE_DAY) {
|
||||
|
||||
@Override
|
||||
public String process(ByteBuffer data) {
|
||||
|
|
|
@ -261,7 +261,7 @@ public class ReleaseInfo {
|
|||
protected static class PatternResource extends CachedResource<String[]> {
|
||||
|
||||
public PatternResource(String resource) {
|
||||
super(resource, String[].class, 24 * 60 * 60 * 1000); // 24h update interval
|
||||
super(resource, String[].class, ONE_WEEK); // 1 week update interval
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,7 +273,7 @@ public class ReleaseInfo {
|
|||
protected static class MovieResource extends CachedResource<Movie[]> {
|
||||
|
||||
public MovieResource(String resource) {
|
||||
super(resource, Movie[].class, 7 * 24 * 60 * 60 * 1000); // check for updates once a week
|
||||
super(resource, Movie[].class, ONE_MONTH); // check for updates every month
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -296,7 +296,7 @@ public class ReleaseInfo {
|
|||
protected static class TheTVDBIndexResource extends CachedResource<TheTVDBSearchResult[]> {
|
||||
|
||||
public TheTVDBIndexResource(String resource) {
|
||||
super(resource, TheTVDBSearchResult[].class, 7 * 24 * 60 * 60 * 1000); // check for updates once a week
|
||||
super(resource, TheTVDBSearchResult[].class, ONE_MONTH); // check for updates once a week
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -318,7 +318,7 @@ public class ReleaseInfo {
|
|||
protected static class AnidbIndexResource extends CachedResource<AnidbSearchResult[]> {
|
||||
|
||||
public AnidbIndexResource(String resource) {
|
||||
super(resource, AnidbSearchResult[].class, 7 * 24 * 60 * 60 * 1000); // check for updates once a week
|
||||
super(resource, AnidbSearchResult[].class, ONE_MONTH); // check for updates once a week
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,10 @@ import net.sf.ehcache.Element;
|
|||
|
||||
public abstract class AbstractCachedResource<R, T extends Serializable> {
|
||||
|
||||
public static final long ONE_MONTH = 30 * 24 * 60 * 60 * 1000;
|
||||
public static final long ONE_WEEK = 7 * 24 * 60 * 60 * 1000;
|
||||
public static final long ONE_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
private String resource;
|
||||
private Class<T> type;
|
||||
private long expirationTime;
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.sf.ehcache.CacheManager;
|
|||
public class CachedPage extends AbstractCachedResource<String, String> {
|
||||
|
||||
public CachedPage(URL url) {
|
||||
super(url.toString(), String.class, 24 * 60 * 60 * 1000, 0, 0); // 24h update interval
|
||||
super(url.toString(), String.class, ONE_DAY, 0, 0); // 24h update interval
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.xml.sax.SAXException;
|
|||
public class CachedXmlResource extends AbstractCachedResource<String, String> {
|
||||
|
||||
public CachedXmlResource(String resource) {
|
||||
super(resource, String.class, 24 * 60 * 60 * 1000, 2, 1000);
|
||||
super(resource, String.class, ONE_WEEK, 2, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue