Bugzilla – Attachment 152474 Details for
Bug 34051
Koha::AuthorisedValues->get_description_by_koha_field not caching results for non-existent values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34051: Cache empty hashref for non-existent authorised values
Bug-34051-Cache-empty-hashref-for-non-existent-aut.patch (text/plain), 1.51 KB, created by
Martin Renvoize (ashimema)
on 2023-06-19 14:19:05 UTC
(
hide
)
Description:
Bug 34051: Cache empty hashref for non-existent authorised values
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-19 14:19:05 UTC
Size:
1.51 KB
patch
obsolete
>From 3efa8bc343aedb88ad7403115e1eed90491443a6 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 19 Jun 2023 01:26:35 +0000 >Subject: [PATCH] Bug 34051: Cache empty hashref for non-existent authorised > values > >When fetching authorised value descriptions, we need to handle >scenarios where a value doesn't exist in the cache and doesn't >exist in the database. In this situation, we return an empty >hashref, and this patch makes us cache this empty hashref. > >This is important because otherwise the function >Koha::AuthorisedValues->get_description_by_koha_field will >do a database call every time it encounters the same value that >doesn't exist in the authorised values table. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/AuthorisedValues.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm >index b52c6c79e6..822be037ea 100644 >--- a/Koha/AuthorisedValues.pm >+++ b/Koha/AuthorisedValues.pm >@@ -110,7 +110,10 @@ sub get_description_by_koha_field { > return $cached if $cached; > > my $av = $self->find_by_koha_field($params); >- return {} unless defined $av; >+ if ( ! defined $av ){ >+ $memory_cache->set_in_cache( $cache_key, {} ); >+ return {}; >+ } > my $descriptions = { lib => $av->lib, opac_description => $av->opac_description }; > $memory_cache->set_in_cache( $cache_key, $descriptions ); > return $descriptions; >-- >2.41.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 34051
:
152457
|
152464
| 152474