From 9442572084f93492e5586171a86974513faa4e36 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Thu, 30 May 2024 11:53:33 +0200 Subject: [PATCH] DBDB: use realtime cache for carriage composition requests --- lib/Travelynx.pm | 11 ++++++----- lib/Travelynx/Helper/DBDB.pm | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index c47f18e..3f8641d 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -362,11 +362,12 @@ sub startup { dbdb => sub { my ($self) = @_; state $dbdb = Travelynx::Helper::DBDB->new( - log => $self->app->log, - cache => $self->app->cache_iris_main, - root_url => $self->base_url_for('/')->to_abs, - user_agent => $self->ua, - version => $self->app->config->{version}, + log => $self->app->log, + main_cache => $self->app->cache_iris_main, + realtime_cache => $self->app->cache_iris_rt, + root_url => $self->base_url_for('/')->to_abs, + user_agent => $self->ua, + version => $self->app->config->{version}, ); } ); diff --git a/lib/Travelynx/Helper/DBDB.pm b/lib/Travelynx/Helper/DBDB.pm index b98a372..8dc3e36 100644 --- a/lib/Travelynx/Helper/DBDB.pm +++ b/lib/Travelynx/Helper/DBDB.pm @@ -31,7 +31,7 @@ sub has_wagonorder_p { my $api_ts = $ts->strftime('%Y%m%d%H%M'); my $url = "https://ist-wr.noncd.db.de/wagenreihung/1.0/${train_no}/${api_ts}"; - my $cache = $self->{cache}; + my $cache = $self->{realtime_cache}; my $promise = Mojo::Promise->new; if ( my $content = $cache->get("HEAD $url") ) { @@ -73,7 +73,7 @@ sub get_wagonorder_p { my $url = "https://ist-wr.noncd.db.de/wagenreihung/1.0/${train_no}/${api_ts}"; - my $cache = $self->{cache}; + my $cache = $self->{realtime_cache}; my $promise = Mojo::Promise->new; if ( my $content = $cache->thaw($url) ) { @@ -113,7 +113,7 @@ sub get_stationinfo_p { my $url = "https://lib.finalrewind.org/dbdb/s/${eva}.json"; - my $cache = $self->{cache}; + my $cache = $self->{main_cache}; my $promise = Mojo::Promise->new; if ( my $content = $cache->thaw($url) ) {