fix: reduce mutability data cache ttl to avoid staleness

addresses #869cdzmkq
This commit is contained in:
Björn Fromme
2026-03-16 12:03:00 +01:00
parent cef2e4fa49
commit 37c839600e
+5 -6
View File
@@ -31,10 +31,10 @@ use Symfony\Contracts\Cache\ItemInterface;
*/
class TravelDataService
{
public const SOURCE_LOCAL = 'local';
public const SOURCE_REMOTE = 'remote';
private const AVAILABILITY_CACHE_TTL = 600;
private const MUTABILITY_CACHE_TTL = 3600;
public const string SOURCE_LOCAL = 'local';
public const string SOURCE_REMOTE = 'remote';
private const int AVAILABILITY_CACHE_TTL = 600;
private const int MUTABILITY_CACHE_TTL = 300;
public function __construct(
private readonly TravelLoader $travelLoader,
@@ -440,7 +440,7 @@ class TravelDataService
* Gets mutability data for a travel date.
*
* @param int $dateId The travel date ID for API call
* @param bool $cached Whether to use cached data (default: true, TTL: 1 hour)
* @param bool $cached Whether to use cached data (default: true, TTL: 5 minutes)
* @param bool $forceRefresh Whether to invalidate cache before fetching (requires cached: true)
*
* @return BaseData|null The mutability data or null if not available or error occurred
@@ -456,7 +456,6 @@ class TravelDataService
}
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($dateId) {
// 1 hour TTL - better safe than sorry with mutability changes
$item->expiresAfter(self::MUTABILITY_CACHE_TTL);
return $this->fetchMutabilityData($dateId);