chore: streamline property naming

This commit is contained in:
Björn Fromme
2025-09-19 16:09:27 +02:00
parent 096dd96db0
commit c9a258a350
18 changed files with 99 additions and 71 deletions
+33
View File
@@ -511,6 +511,39 @@ class TravelDataService
}
}
/**
* Fetch availability data with short-term caching.
*
* Retrieves availability information from the API with caching to reduce
* API calls during booking form interactions. Uses a short TTL to ensure
* reasonably fresh data while avoiding excessive API requests.
*
* @param int $dateId The travel date ID for API call
* @param int $ttl Cache TTL in seconds (default: 60 seconds)
*
* @return BaseData|null The availability data or null if not available or error occurred
*/
public function getAvailabilityDataCached(int $dateId, int $ttl = 60): ?BaseData
{
$cacheKey = sprintf('availability_%d', $dateId);
try {
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($dateId, $ttl) {
$item->expiresAfter($ttl);
return $this->getAvailabilityData($dateId);
});
} catch (InvalidArgumentException $e) {
$this->logger->error('Cache error in getAvailabilityDataCached', [
'dateId' => $dateId,
'error' => $e->getMessage(),
]);
// Fallback to direct API call
return $this->getAvailabilityData($dateId);
}
}
/**
* Apply availability data to travel services.
*