diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-09-24 17:26:12 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-09-24 17:36:04 +0200 |
commit | 9377df363789cfe0d9333938584a50a42c3e9844 (patch) | |
tree | 143b8494abe89c49335d3944dd140074394a9e91 | |
parent | 1f9b5d832a2eb0bee0930b11dee424d19419fbd7 (diff) |
Do not cache JSON exported data longer than 1 minute (normal data: 3 min)
-rw-r--r-- | cgi/index.pl | 7 |
1 files 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} ) { |