Commit c93445f1 authored by Leigh B Stoller's avatar Leigh B Stoller

Cache return from IMS to avoid asking for the same image data

100s of times in really big experiments.
parent bbd3789e
......@@ -224,17 +224,27 @@ sub DeleteImageData($$;$)
#
# If we do not have a local copy, try to load it using the URL.
#
# Cache just for this, to avoid repeated calls for same image.
#
my %localblobcache = ();
sub MapToLocalImage($$)
{
my ($urn, $pid) = @_;
my $blob;
my $blob = GetImageData($urn);
return $blob
if (GeniResponse::IsError($blob));
my $url = $blob->{'metadata_url'};
if (exists($localblobcache{$urn})) {
$blob = $localblobcache{$urn};
}
else {
$blob = GetImageData($urn);
return $blob
if (GeniResponse::IsError($blob));
$localblobcache{$urn} = $blob;
}
my $url = $blob->{'metadata_url'};
print STDERR Dumper($blob);
#print STDERR Dumper($blob);
#
# So, look to see if the user is trying to use an image that is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment