summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-06-07 16:31:30 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-06-07 16:31:30 +0200
commit1fb2c0b50e098207b484022f21643428555bbc1a (patch)
tree88937b57e67d65b8f185730cb5873ceff4c0c8b4 /lib/DBInfoscreen.pm
parentd6600fc006060699f9e79593e2698e21b2acd081 (diff)
use global cache objects, also cache wagon order2.3.1
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r--lib/DBInfoscreen.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index 548fce2..d83f58f 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -4,6 +4,7 @@ use Mojo::Base 'Mojolicious';
# Copyright (C) 2011-2019 Daniel Friesel <derf+dbf@finalrewind.org>
# License: 2-Clause BSD
+use Cache::File;
use Travel::Status::DE::HAFAS;
use Travel::Status::DE::HAFAS::StopFinder;
use Travel::Status::DE::IRIS::Stations;
@@ -23,6 +24,42 @@ my %default = (
sub startup {
my ($self) = @_;
+ $self->attr(
+ cache_hafas => sub {
+ my ($self) = @_;
+ return Cache::File->new(
+ cache_root => $ENV{DBFAKEDISPLAY_HAFAS_CACHE}
+ // '/tmp/dbf-hafas',
+ default_expires => '180 seconds',
+ lock_level => Cache::File::LOCK_LOCAL(),
+ );
+ }
+ );
+
+ $self->attr(
+ cache_iris_main => sub {
+ my ($self) = @_;
+ return Cache::File->new(
+ cache_root => $ENV{DBFAKEDISPLAY_IRIS_CACHE}
+ // '/tmp/dbf-iris-main',
+ default_expires => '6 hours',
+ lock_level => Cache::File::LOCK_LOCAL(),
+ );
+ }
+ );
+
+ $self->attr(
+ cache_iris_rt => sub {
+ my ($self) = @_;
+ return Cache::File->new(
+ cache_root => $ENV{DBFAKEDISPLAY_IRISRT_CACHE}
+ // '/tmp/dbf-iris-realtime',
+ default_expires => '70 seconds',
+ lock_level => Cache::File::LOCK_LOCAL(),
+ );
+ }
+ );
+
$self->helper(
'handle_no_results' => sub {
my ( $self, $backend, $station, $errstr ) = @_;