From 0fba151cc267ef117e8dbca9f0912b5ee08fdc45 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 30 May 2019 14:09:56 +0200 Subject: Store decoded JSON objects in cache, not raw strings --- lib/DBInfoscreen/Controller/Stationboard.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 73941c0..1fb4a26 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -105,7 +105,7 @@ sub hafas_json_req { my ( $ua, $cache, $url ) = @_; if ( my $content = $cache->thaw($url) ) { - return decode_json( ${$content} ); + return $content; } my $res = $ua->get($url)->result; @@ -121,9 +121,11 @@ sub hafas_json_req { $body =~ s{(}{(}g; $body =~ s{)}{)}g; - $cache->freeze( $url, \$body ); + my $json = decode_json($body); - return decode_json($body); + $cache->freeze( $url, $json ); + + return $json; } # quick&dirty, will be cleaned up later -- cgit v1.2.3