View | Details | Raw Unified | Return to bug 7248
Collapse All | Expand All

(-)a/C4/Biblio.pm (-16 / +8 lines)
Lines 136-151 BEGIN { Link Here
136
    );
136
    );
137
}
137
}
138
138
139
eval {
140
    if (C4::Context->ismemcached) {
141
        require Memoize::Memcached;
142
        import Memoize::Memcached qw(memoize_memcached);
143
144
        memoize_memcached( 'GetMarcStructure',
145
                            memcached => C4::Context->memcached);
146
    }
147
};
148
149
=head1 NAME
139
=head1 NAME
150
140
151
C4::Biblio - cataloging management functions
141
C4::Biblio - cataloging management functions
Lines 1058-1069 sub GetMarcStructure { Link Here
1058
    if ( defined $marc_structure_cache and exists $marc_structure_cache->{$forlibrarian}->{$frameworkcode} ) {
1048
    if ( defined $marc_structure_cache and exists $marc_structure_cache->{$forlibrarian}->{$frameworkcode} ) {
1059
        return $marc_structure_cache->{$forlibrarian}->{$frameworkcode};
1049
        return $marc_structure_cache->{$forlibrarian}->{$frameworkcode};
1060
    }
1050
    }
1061
1051
    my $cache = Koha::Cache->new();
1062
    #     my $sth = $dbh->prepare(
1052
    if ($cache) {
1063
    #         "SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode=?");
1053
        my $cached = $cache->get_from_cache("GetMarcStructure:$frameworkcode:$forlibrarian");
1064
    #     $sth->execute($frameworkcode);
1054
        return $cached if $cached;
1065
    #     my ($total) = $sth->fetchrow;
1055
    }
1066
    #     $frameworkcode = "" unless ( $total > 0 );
1067
    my $sth = $dbh->prepare(
1056
    my $sth = $dbh->prepare(
1068
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
1057
        "SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
1069
        FROM marc_tag_structure 
1058
        FROM marc_tag_structure 
Lines 1127-1132 sub GetMarcStructure { Link Here
1127
1116
1128
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
1117
    $marc_structure_cache->{$forlibrarian}->{$frameworkcode} = $res;
1129
1118
1119
    if ($cache) {
1120
        $cache->set_in_cache("GetMarcStructure:$frameworkcode:$forlibrarian",$res,10000);
1121
    }
1130
    return $res;
1122
    return $res;
1131
}
1123
}
1132
1124
(-)a/C4/Languages.pm (-11 / +21 lines)
Lines 23-41 use strict; Link Here
23
#use warnings; FIXME - Bug 2505
23
#use warnings; FIXME - Bug 2505
24
use Carp;
24
use Carp;
25
use C4::Context;
25
use C4::Context;
26
use Koha::Cache;
26
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
27
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
27
28
28
eval {
29
    if (C4::Context->ismemcached) {
30
        require Memoize::Memcached;
31
        import Memoize::Memcached qw(memoize_memcached);
32
33
        memoize_memcached('getTranslatedLanguages', memcached => C4::Context->memcached);
34
        memoize_memcached('getFrameworkLanguages' , memcached => C4::Context->memcached);
35
        memoize_memcached('getAllLanguages',        memcached => C4::Context->memcached);
36
    }
37
};
38
39
BEGIN {
29
BEGIN {
40
    $VERSION = 3.00;
30
    $VERSION = 3.00;
41
    require Exporter;
31
    require Exporter;
Lines 77-82 Returns a reference to an array of hashes: Link Here
77
=cut
67
=cut
78
68
79
sub getFrameworkLanguages {
69
sub getFrameworkLanguages {
70
    
71
    my $cache = Koha::Cache->new();
72
    if ($cache) {
73
        my $cached = $cache->get_from_cache("getFrameworkLanguages");
74
        return $cached if $cached;
75
    }
80
    # get a hash with all language codes, names, and locale names
76
    # get a hash with all language codes, names, and locale names
81
    my $all_languages = getAllLanguages();
77
    my $all_languages = getAllLanguages();
82
    my @languages;
78
    my @languages;
Lines 99-104 sub getFrameworkLanguages { Link Here
99
            }
95
            }
100
        }
96
        }
101
    }
97
    }
98
    if ($cache) {
99
        $cache->set_in_cache("getFrameworkLanguages",\@languages,10000)
100
    }
102
    return \@languages;
101
    return \@languages;
103
}
102
}
104
103
Lines 179-184 Returns a reference to an array of hashes: Link Here
179
=cut
178
=cut
180
179
181
sub getAllLanguages {
180
sub getAllLanguages {
181
    # retrieve from cache if applicable
182
    my $cache = Koha::Cache->new();
183
    if ($cache) {
184
        my $cached = $cache->get_from_cache("getAllLanguages");
185
        if ($cached) {
186
            return $cached;
187
        }
188
    }
182
    my @languages_loop;
189
    my @languages_loop;
183
    my $dbh=C4::Context->dbh;
190
    my $dbh=C4::Context->dbh;
184
    my $current_language = shift || 'en';
191
    my $current_language = shift || 'en';
Lines 213-218 sub getAllLanguages { Link Here
213
        }
220
        }
214
        push @languages_loop, $language_subtag_registry;
221
        push @languages_loop, $language_subtag_registry;
215
    }
222
    }
223
    if ($cache) {
224
        $cache->set_in_cache("getAllLanguages",\@languages_loop,1000);
225
    }
216
    return \@languages_loop;
226
    return \@languages_loop;
217
}
227
}
218
228
(-)a/reports/guided_reports.pl (-2 / +2 lines)
Lines 28-33 use C4::Output; Link Here
28
use C4::Dates;
28
use C4::Dates;
29
use C4::Debug;
29
use C4::Debug;
30
use C4::Branch; # XXX subfield_is_koha_internal_p
30
use C4::Branch; # XXX subfield_is_koha_internal_p
31
use Koha::Cache;
31
32
32
=head1 NAME
33
=head1 NAME
33
34
Lines 40-46 Script to control the guided report creation Link Here
40
=cut
41
=cut
41
42
42
my $input = new CGI;
43
my $input = new CGI;
43
my $usecache = C4::Context->ismemcached;
44
my $usecache = Koha::Cache->new()?1:0;
44
45
45
my $phase = $input->param('phase');
46
my $phase = $input->param('phase');
46
my $flagsrequired;
47
my $flagsrequired;
47
- 

Return to bug 7248