Bugzilla – Attachment 177487 Details for
Bug 31856
Improve performance of serials subscriptions search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31856: Refactor after adding bug 36350 as a dependency
Bug-31856-Refactor-after-adding-bug-36350-as-a-dep.patch (text/plain), 4.00 KB, created by
David Gustafsson
on 2025-02-03 20:16:14 UTC
(
hide
)
Description:
Bug 31856: Refactor after adding bug 36350 as a dependency
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2025-02-03 20:16:14 UTC
Size:
4.00 KB
patch
obsolete
>From 9d4407a3c64434f75027cfb144e09a130fef63ab Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 3 Feb 2025 19:25:30 +0100 >Subject: [PATCH] Bug 31856: Refactor after adding bug 36350 as a dependency > >--- > Koha/AuthorisedValue.pm | 2 +- > Koha/AuthorisedValues.pm | 51 ++++++++++------------------------------ > 2 files changed, 14 insertions(+), 39 deletions(-) > >diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm >index 0d792cccd22..e402837fccd 100644 >--- a/Koha/AuthorisedValue.pm >+++ b/Koha/AuthorisedValue.pm >@@ -25,7 +25,7 @@ use Koha::Exceptions; > use Koha::Object; > use Koha::Object::Limit::Library; > >-use base qw(Koha::Object Koha::Object::Limit::Library); >+use base qw(Koha::Object::CachedExpiration Koha::Object::Limit::Library); > > use constant NUM_PATTERN => q{^(-[1-9][0-9]*|0|[1-9][0-9]*)$}; > use constant NUM_PATTERN_JS => q{(-[1-9][0-9]*|0|[1-9][0-9]*)}; # ^ and $ removed >diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm >index 5cadb4f1baa..eb27a9982f7 100644 >--- a/Koha/AuthorisedValues.pm >+++ b/Koha/AuthorisedValues.pm >@@ -26,7 +26,7 @@ use Koha::AuthorisedValue; > use Koha::MarcSubfieldStructures; > use Koha::Cache::Memory::Lite; > >-use base qw(Koha::Objects Koha::Objects::Limit::Library); >+use base qw(Koha::Objects::Cached Koha::Objects::Limit::Library); > > =head1 NAME > >@@ -104,16 +104,8 @@ sub get_description_by_koha_field { > > return {} unless defined $authorised_value; > >- my $memory_cache = Koha::Cache::Memory::Lite->get_instance; >- my $cache_key = "AV_descriptions:$frameworkcode:$kohafield:$authorised_value"; >- my $description = $memory_cache->get_from_cache($cache_key); >- >- unless (defined $description) { >- my $av = $self->find_by_koha_field($params); >- $description = defined $av ? { lib => $av->lib, opac_description => $av->opac_description } : {}; >- $memory_cache->set_in_cache( $cache_key, $description ); >- } >- return $description; >+ my $av = $self->find_by_koha_field($params); >+ return defined $av ? { lib => $av->lib, opac_description => $av->opac_description } : {}; > } > > sub get_descriptions_by_koha_field { >@@ -121,23 +113,16 @@ sub get_descriptions_by_koha_field { > my $frameworkcode = $params->{frameworkcode} || ''; > my $kohafield = $params->{kohafield}; > >- my $memory_cache = Koha::Cache::Memory::Lite->get_instance; >- my $cache_key = "AV_descriptions:$frameworkcode:$kohafield"; >- my $descriptions = $memory_cache->get_from_cache($cache_key); >- >- unless (defined $descriptions) { >- my @avs = $self->search_by_koha_field($params)->as_list; >- $descriptions = [ >- map { >- { >- authorised_value => $_->authorised_value, >- lib => $_->lib, >- opac_description => $_->opac_description >- } >- } @avs >- ]; >- $memory_cache->set_in_cache( $cache_key, $descriptions ); >- } >+ my @avs = $self->search_by_koha_field($params)->as_list; >+ my $descriptions = [ >+ map { >+ { >+ authorised_value => $_->authorised_value, >+ lib => $_->lib, >+ opac_description => $_->opac_description >+ } >+ } @avs >+ ]; > return @{$descriptions}; > } > >@@ -184,21 +169,11 @@ sub get_descriptions_by_marc_field { > > return {} unless defined $params->{tagfield}; > >- my $memory_cache = Koha::Cache::Memory::Lite->get_instance; >- my $cache_key = "AV_descriptions_by_MARC:$frameworkcode:$tagfield"; >- if ($tagsubfield) { >- $cache_key .= ":$tagsubfield"; >- } >- >- my $cached = $memory_cache->get_from_cache($cache_key); >- return $cached if $cached; >- > my $descriptions = {}; > my @avs = $self->search_by_marc_field($params)->as_list; > foreach my $av (@avs) { > $descriptions->{ $av->authorised_value } = $av->lib; > } >- $memory_cache->set_in_cache( $cache_key, $descriptions ); > return $descriptions; > } > >-- >2.48.1
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 31856
:
142058
|
142156
|
142157
|
150651
|
150652
|
150653
|
151077
|
151078
|
177383
|
177384
|
177385
|
177386
|
177387
|
177482
|
177483
|
177484
|
177485
|
177486
| 177487 |
177509
|
177510
|
177511
|
177512
|
177514