Bugzilla – Attachment 103009 Details for
Bug 20116
Improve performance by caching the language list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20116: Cache language list
Bug-20116-Cache-language-list.patch (text/plain), 2.08 KB, created by
Marcel de Rooy
on 2020-04-15 14:00:56 UTC
(
hide
)
Description:
Bug 20116: Cache language list
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-04-15 14:00:56 UTC
Size:
2.08 KB
patch
obsolete
>From f5a96449425c4715a580ba621e330941005f3390 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 31 Jan 2018 14:51:22 -0300 >Subject: [PATCH] Bug 20116: Cache language list >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Languages.pm | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 0916dd4610..fad761dfb2 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -26,6 +26,7 @@ use Carp; > use CGI; > use List::MoreUtils qw( any ); > use C4::Context; >+use Koha::Caches; > use Koha::Cache::Memory::Lite; > use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); > >@@ -117,13 +118,27 @@ sub getTranslatedLanguages { > ? split ",", C4::Context->preference('language') > : split ",", C4::Context->preference('opaclanguages'); > >+ my $cache = Koha::Caches->get_instance; >+ my $cache_key = "languages_${interface}_${theme}"; > if ($interface && $interface eq 'opac' ) { > my $htdocs = C4::Context->config('opachtdocs'); >- @languages = _get_opac_language_dirs( $htdocs, $theme ); >+ my $cached = $cache->get_from_cache($cache_key); >+ if ( $cached ) { >+ @languages = @{$cached}; >+ } else { >+ @languages = _get_opac_language_dirs( $htdocs, $theme ); >+ $cache->set_in_cache($cache_key, \@languages ); >+ } > } > elsif ($interface && $interface eq 'intranet' ) { > my $htdocs = C4::Context->config('intrahtdocs'); >- @languages = _get_intranet_language_dirs( $htdocs, $theme ); >+ my $cached = $cache->get_from_cache($cache_key); >+ if ( $cached ) { >+ @languages = @{$cached}; >+ } else { >+ @languages = _get_intranet_language_dirs( $htdocs, $theme ); >+ $cache->set_in_cache($cache_key, \@languages ); >+ } > } > else { > my $htdocs = C4::Context->config('intrahtdocs'); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20116
:
71097
|
71098
|
73521
|
73619
|
73620
|
75382
|
75383
|
75384
|
75385
|
88200
|
88201
|
88202
|
94995
|
94996
|
94997
|
99431
|
99432
|
99433
|
103007
|
103008
| 103009 |
105359