Skip to content

Commit

Permalink
Merge pull request #542 from mobidata-bw/issues/537_station_cache
Browse files Browse the repository at this point in the history
Improve: introduce configurable stationEntityCacheMinimumTtl and stationEntityCacheMaximumTtl
  • Loading branch information
testower authored Sep 26, 2024
2 parents 8167a23 + 4017c9b commit 9cda51f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
Expand All @@ -64,6 +65,12 @@ public class StationsUpdater {

private final MetricsService metricsService;

@Value("${org.entur.lamassu.stationEntityCacheMinimumTtl:30}")
private Integer stationEntityCacheMinimumTtl;

@Value("${org.entur.lamassu.stationEntityCacheMaximumTtl:300}")
private Integer stationEntityCacheMaximumTtl;

@Autowired
public StationsUpdater(
StationCache stationCache,
Expand Down Expand Up @@ -223,7 +230,8 @@ public void addOrUpdateStations(
(int) Instant.now().getEpochSecond(),
(int) lastUpdated.getTime() / 1000,
ttl,
300
stationEntityCacheMinimumTtl,
stationEntityCacheMaximumTtl
),
TimeUnit.SECONDS
);
Expand Down

0 comments on commit 9cda51f

Please sign in to comment.