summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-30 14:09:56 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-30 14:09:56 +0200
commit0fba151cc267ef117e8dbca9f0912b5ee08fdc45 (patch)
tree0334617e14ebc77302eec7c2e82a8488d4950893
parent7c28042bb4b9c268303df0188498f491464d9a7e (diff)
Store decoded JSON objects in cache, not raw strings
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm8
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{&#x0028;}{(}g;
$body =~ s{&#x0029;}{)}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