From a6bd90c48cae4eae7cd16fd3e8f46e152b7c74b0 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 21 Jan 2008 14:14:41 -0600 Subject: [PATCH] added caching of results of GetMarcStructure Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 96a7c5bdca..e992df91d6 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -576,10 +576,19 @@ $frameworkcode : the framework code to read =cut +# cache for results of GetMarcStructure -- needed +# for batch jobs +our $marc_structure_cache; + sub GetMarcStructure { my ( $forlibrarian, $frameworkcode ) = @_; my $dbh=C4::Context->dbh; $frameworkcode = "" unless $frameworkcode; + + if (defined $marc_structure_cache and exists $marc_structure_cache->{$forlibrarian}->{$frameworkcode}) { + return $marc_structure_cache->{$forlibrarian}->{$frameworkcode}; + } + my $sth; my $libfield = ( $forlibrarian eq 1 ) ? 'liblibrarian' : 'libopac'; @@ -659,6 +668,9 @@ sub GetMarcStructure { $res->{$tag}->{$subfield}->{'link'} = $link; $res->{$tag}->{$subfield}->{defaultvalue} = $defaultvalue; } + + $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res; + return $res; } -- 2.11.0