From 23eb0840492beeba17331dc02e5d8cc4722bdb3f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 7 Jan 2016 20:14:29 +0100 Subject: iris-delay-stats: use cache for static IRIS data --- bin/iris-delay-stats | 12 ++++++++++-- 1 file 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 = ( -- cgit v1.2.3