Skip to content

Commit

Permalink
Entur: make cache ttl for organisations configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Nov 12, 2024
1 parent 0193b01 commit f081f7e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
@Profile("entur-legacy-organisation-registry")
public class EnturLegacyOrganisationRegistry implements OrganisationRegistry {

@Value("${no.entur.uttu.ext.entur.organisation.cache-ttl-minutes:60}")
private int cacheTtlMinutes;

private final Logger logger = LoggerFactory.getLogger(this.getClass());
private static final int HTTP_TIMEOUT = 10000;

Expand All @@ -66,7 +69,7 @@ public class EnturLegacyOrganisationRegistry implements OrganisationRegistry {

private final LoadingCache<String, List<Organisation>> organisationsCache = CacheBuilder
.newBuilder()
.expireAfterWrite(6, TimeUnit.HOURS)
.expireAfterWrite(cacheTtlMinutes, TimeUnit.MINUTES)
.build(
new CacheLoader<>() {
@Override
Expand All @@ -78,7 +81,7 @@ public List<Organisation> load(String unused) {

private final LoadingCache<String, Organisation> organisationCache = CacheBuilder
.newBuilder()
.expireAfterWrite(6, TimeUnit.HOURS)
.expireAfterWrite(cacheTtlMinutes, TimeUnit.MINUTES)
.build(
new CacheLoader<>() {
@Override
Expand Down

0 comments on commit f081f7e

Please sign in to comment.