summaryrefslogtreecommitdiff
path: root/bin/iris-delay-stats
diff options
context:
space:
mode:
Diffstat (limited to 'bin/iris-delay-stats')
-rwxr-xr-xbin/iris-delay-stats12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/iris-delay-stats b/bin/iris-delay-stats
index 12cfb80..5afbc62 100755
--- a/bin/iris-delay-stats
+++ b/bin/iris-delay-stats
@@ -4,6 +4,7 @@ use strict;
use warnings;
use 5.010;
+use Cache::File;
use DBI;
use List::Util qw(first);
use Travel::Status::DE::IRIS;
@@ -16,6 +17,12 @@ my $dbname = shift // 'dbdb';
my $dbh = DBI->connect( "dbi:Pg:dbname=$dbname;host=localhost;port=5432",
'dbdb', $ENV{DBDB_PASSWORD} );
+my $cache = Cache::File->new(
+ cache_root => '/tmp/dbdb-cache',
+ default_expires => '2 hours',
+ lock_level => Cache::File::LOCK_LOCAL(),
+);
+
sub int_or_undef {
my ($val) = @_;
@@ -180,8 +187,9 @@ for my $msg ( 1 .. 99 ) {
}
my $status = Travel::Status::DE::IRIS->new(
- station => $station,
- lookahead => 60
+ station => $station,
+ lookahead => 60,
+ main_cache => $cache,
);
my @fields = (