summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-05-30 11:53:33 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-05-30 11:53:33 +0200
commit9442572084f93492e5586171a86974513faa4e36 (patch)
tree8678d0d95b2ab7c45a971614189fd0493594afa9
parent2576a463db327e8fdfbf225e91ec7b775bbcad39 (diff)
DBDB: use realtime cache for carriage composition requests
-rwxr-xr-xlib/Travelynx.pm11
-rw-r--r--lib/Travelynx/Helper/DBDB.pm6
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) ) {