Add 24-hour TTL to Eurostar price cache
Cache reads now accept an optional ttl (seconds). get_cached checks the file mtime and returns None if the entry is older than the TTL, triggering a fresh fetch. Eurostar prices use a 24-hour TTL; timetable caches remain indefinite (date-scoped keys become irrelevant once the date passes). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0dee942e16
commit
6b044b9493
4 changed files with 52 additions and 6 deletions
2
app.py
2
app.py
|
|
@ -85,7 +85,7 @@ def results(slug, travel_date):
|
|||
|
||||
cached_rtt = get_cached(rtt_cache_key)
|
||||
cached_es = get_cached(es_cache_key)
|
||||
cached_prices = get_cached(prices_cache_key)
|
||||
cached_prices = get_cached(prices_cache_key, ttl=24 * 3600)
|
||||
from_cache = bool(cached_rtt and cached_es and cached_prices)
|
||||
|
||||
error = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue