diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-01-07 20:14:29 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-01-07 20:14:29 +0100 |
commit | 23eb0840492beeba17331dc02e5d8cc4722bdb3f (patch) | |
tree | 6b540e1d1164bbeee32179fec8bb720b94257881 | |
parent | ffccf21f877598e1bca6a1b3911c2d2e16fbc786 (diff) |
iris-delay-stats: use cache for static IRIS data
-rwxr-xr-x | bin/iris-delay-stats | 12 |
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 = ( |