From 9377df363789cfe0d9333938584a50a42c3e9844 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 24 Sep 2013 17:26:12 +0200 Subject: Do not cache JSON exported data longer than 1 minute (normal data: 3 min) --- cgi/index.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cgi/index.pl b/cgi/index.pl index 8ca7c5c..03b2a3b 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -24,9 +24,9 @@ my %default = ( ); sub get_results { - my ( $backend, $city, $stop ) = @_; + my ( $backend, $city, $stop, $expiry ) = @_; - my $expiry = 420; + my $expiry ||= 150; my $cache = Cache::File->new( cache_root => '/tmp/vrr-fake', @@ -153,7 +153,7 @@ sub get_departures { my @fmt_departures; my ( $results, $errstr ) - = get_results( $opt{backend}, $opt{city}, $opt{stop} ); + = get_results( $opt{backend}, $opt{city}, $opt{stop}, $opt{cache_expiry} ); my $dt_now = DateTime->now( time_zone => 'Europe/Berlin' ); my $strp_simple = DateTime::Format::Strptime->new( @@ -302,6 +302,7 @@ sub render_json { filter_line => scalar $self->param('line'), filter_platform => scalar $self->param('platform'), offset => scalar $self->param('offset'), + cache_expiry => 60, ); for my $d ( @{$departures} ) { -- cgit v1.2.3