Commit 0fba151c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Store decoded JSON objects in cache, not raw strings

parent 7c28042b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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