mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
grace period to make sure data is always fresh when TTL is almost about to be reached
This commit is contained in:
parent
eb25b1e1b3
commit
0304a12b76
@ -12,16 +12,17 @@ import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import net.filebot.CachedResource.Transform;
|
||||
import net.sf.ehcache.Element;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class Cache {
|
||||
|
||||
public static final Duration ONE_DAY = Duration.ofDays(1);
|
||||
public static final Duration ONE_WEEK = Duration.ofDays(7);
|
||||
public static final Duration ONE_MONTH = Duration.ofDays(30);
|
||||
// grace period to make sure data is always fresh when TTL is almost about to be reached
|
||||
public static final Duration ONE_DAY = Duration.ofHours(18);
|
||||
public static final Duration ONE_WEEK = Duration.ofDays(6);
|
||||
public static final Duration ONE_MONTH = Duration.ofDays(24);
|
||||
|
||||
public static Cache getCache(String name, CacheType type) {
|
||||
return CacheManager.getInstance().getCache(name.toLowerCase() + "_" + type.ordinal(), type);
|
||||
|
@ -12,15 +12,15 @@ public enum CacheType {
|
||||
|
||||
Weekly(Duration.ofDays(12), true),
|
||||
|
||||
Daily(Duration.ofHours(24), true),
|
||||
Daily(Duration.ofHours(18), true),
|
||||
|
||||
Ephemeral(Duration.ofHours(6), false);
|
||||
Ephemeral(Duration.ofHours(2), false);
|
||||
|
||||
final long timeToLiveSeconds;
|
||||
final boolean diskPersistent;
|
||||
|
||||
CacheType(Duration timeToLive, boolean diskPersistent) {
|
||||
this.timeToLiveSeconds = timeToLive.minusHours(1).getSeconds(); // 60 minutes grace period to make sure data is always fresh when TTL is almost about to be exceeded
|
||||
this.timeToLiveSeconds = timeToLive.getSeconds();
|
||||
this.diskPersistent = diskPersistent;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user