diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-05-30 14:09:56 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-05-30 14:09:56 +0200 |
commit | 0fba151cc267ef117e8dbca9f0912b5ee08fdc45 (patch) | |
tree | 0334617e14ebc77302eec7c2e82a8488d4950893 /lib | |
parent | 7c28042bb4b9c268303df0188498f491464d9a7e (diff) |
Store decoded JSON objects in cache, not raw strings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 8 |
1 files 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 |