diff --git a/app/DataProviders/CachedHafas.php b/app/DataProviders/CachedHafas.php index 6963bb9ac..619367823 100644 --- a/app/DataProviders/CachedHafas.php +++ b/app/DataProviders/CachedHafas.php @@ -15,7 +15,7 @@ class CachedHafas extends Hafas implements DataProviderInterface { public function fetchHafasTrip(string $tripID, string $lineName): Trip { - $key = CacheKey::getHafasTripKey($tripID); + $key = CacheKey::getHafasTripKey($tripID, $lineName); return $this->remember($key, now()->addMinutes(15), function() use ($tripID, $lineName) { return parent::fetchHafasTrip($tripID, $lineName); diff --git a/app/Helpers/CacheKey.php b/app/Helpers/CacheKey.php index 7c585a7da..e4f75295c 100644 --- a/app/Helpers/CacheKey.php +++ b/app/Helpers/CacheKey.php @@ -22,7 +22,7 @@ class CacheKey private const string LEADERBOARD_FRIENDS = 'LeaderboardFriends'; private const string LEADERBOARD_MONTH = 'LeaderboardMonth'; private const string STATISTICS_GLOBAL = 'StatisticsGlobal'; - private const string HAFAS_TRIP = '_HafasTrip'; + private const string HAFAS_TRIP = '_HafasTrip_%s_%s'; private const string HAFAS_STATIONS = '_HafasStations'; private const string HAFAS_DEPARTURES = '_HafasDepartures_%d_%s_%s'; private const string HAFAFS_STATION_RIL = '_HafasStationRil'; @@ -32,8 +32,9 @@ class CacheKey private const string FOR = '%s-for-%s'; private const string FROM_TO = '%s-from-%s-to-%s'; - public static function getHafasTripKey(string $tripId): string { - return sprintf(self::FOR, self::HAFAS_TRIP, $tripId); + public static function getHafasTripKey(string $tripId, string $lineName): string { + $tripId = sha1($tripId); + return sprintf(self::HAFAS_TRIP, $tripId, $lineName); } public static function getHafasStationsKey(string $query): string { diff --git a/config/trwl.php b/config/trwl.php index 8fb26eb79..afb183b2a 100644 --- a/config/trwl.php +++ b/config/trwl.php @@ -56,7 +56,7 @@ 'cache' => [ 'global-statistics-retention-seconds' => env('GLOBAL_STATISTICS_CACHE_RETENTION_SECONDS', 60 * 60), 'leaderboard-retention-seconds' => env('LEADERBOARD_CACHE_RETENTION_SECONDS', 5 * 60), - 'hafas' => env('HAFAS_CACHE', true), + 'hafas' => env('HAFAS_CACHE', false), ], 'year_in_review' => [ 'alert' => env('YEAR_IN_REVIEW_ALERT', false),