Bugzilla – Attachment 148092 Details for
Bug 30920
Add caching to C4::Biblio::GetAuthorisedValueDesc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30920: (follow-up) Flush on delete
Bug-30920-follow-up-Flush-on-delete.patch (text/plain), 5.16 KB, created by
Martin Renvoize (ashimema)
on 2023-03-10 16:38:17 UTC
(
hide
)
Description:
Bug 30920: (follow-up) Flush on delete
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-03-10 16:38:17 UTC
Size:
5.16 KB
patch
obsolete
>From 2727fd15688fbfb62eb01b77bd3c5b8facf731f1 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 10 Mar 2023 15:26:45 +0000 >Subject: [PATCH] Bug 30920: (follow-up) Flush on delete > >We missed the flush on delete triggers for the various caches introduced >here. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/AuthorisedValue.pm | 18 ++++++++++++++++-- > Koha/ClassSource.pm | 17 +++++++++++++++-- > Koha/ItemType.pm | 15 ++++++++++++++- > Koha/Library.pm | 15 ++++++++++++++- > Koha/Localization.pm | 18 +++++++++++++++++- > 5 files changed, 76 insertions(+), 7 deletions(-) > >diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm >index 0fc5f4cd1b..039b8abbef 100644 >--- a/Koha/AuthorisedValue.pm >+++ b/Koha/AuthorisedValue.pm >@@ -23,6 +23,8 @@ use Koha::Caches; > use Koha::Database; > > use base qw(Koha::Object Koha::Object::Limit::Library); >+ >+my $cache = Koha::Caches->get_instance(); > > =head1 NAME > >@@ -61,14 +63,26 @@ sub store { > $self = $self->SUPER::store; > > if ($flush) { >- my $cache = Koha::Caches->get_instance(); >- my $key = "AVDescriptions-".$self->category; >+ my $key = "AV_descriptions:".$self->category; > $cache->clear_from_cache($key); > } > > return $self; > } > >+=head2 delete >+ >+AuthorisedValue specific C<delete> to clear relevant caches on delete. >+ >+=cut >+ >+sub delete { >+ my $self = shift @_; >+ my $key = "AV_descriptions:".$self->category; >+ $cache->clear_from_cache($key); >+ $self->SUPER::delete(@_); >+} >+ > =head3 opac_description > > my $description = $av->opac_description(); >diff --git a/Koha/ClassSource.pm b/Koha/ClassSource.pm >index cabb0add58..f6994a1763 100644 >--- a/Koha/ClassSource.pm >+++ b/Koha/ClassSource.pm >@@ -22,6 +22,8 @@ use Koha::Database; > > use base qw(Koha::Object); > >+my $cache = Koha::Caches->get_instance(); >+ > =head1 NAME > > Koha::ClassSource - Koha Classfication Source Object class >@@ -52,13 +54,24 @@ sub store { > $self = $self->SUPER::store; > > if ($flush) { >- my $cache = Koha::Caches->get_instance(); >- $cache->clear_from_cache('cn)sources:description'); >+ $cache->clear_from_cache('cn_sources:description'); > } > > return $self; > } > >+=head2 delete >+ >+ClassSource specific C<delete> to clear relevant caches on delete. >+ >+=cut >+ >+sub delete { >+ my $self = shift @_; >+ $cache->clear_from_cache('cn_sources:description'); >+ $self->SUPER::delete(@_); >+} >+ > =head3 _type > > Returns name of corresponding DBIC resultset >diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm >index 0a8c335ddf..dbbae3fbfc 100644 >--- a/Koha/ItemType.pm >+++ b/Koha/ItemType.pm >@@ -27,6 +27,8 @@ use Koha::Localizations; > > use base qw(Koha::Object Koha::Object::Limit::Library); > >+my $cache = Koha::Caches->get_instance(); >+ > =head1 NAME > > Koha::ItemType - Koha Item type Object class >@@ -59,7 +61,6 @@ sub store { > $self = $self->SUPER::store; > > if ($flush) { >- my $cache = Koha::Caches->get_instance(); > my $key = "itemtype:description:en"; > $cache->clear_from_cache($key); > } >@@ -67,6 +68,18 @@ sub store { > return $self; > } > >+=head2 delete >+ >+ItemType specific C<delete> to clear relevant caches on delete. >+ >+=cut >+ >+sub delete { >+ my $self = shift @_; >+ $cache->clear_from_cache('itemtype:description:en'); >+ $self->SUPER::delete(@_); >+} >+ > =head3 image_location > > =cut >diff --git a/Koha/Library.pm b/Koha/Library.pm >index fa4496c323..2e9259b450 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -29,6 +29,8 @@ use Koha::SMTP::Servers; > > use base qw(Koha::Object); > >+my $cache = Koha::Caches->get_instance(); >+ > =head1 NAME > > Koha::Library - Koha Library Object class >@@ -59,13 +61,24 @@ sub store { > $self = $self->SUPER::store; > > if ($flush) { >- my $cache = Koha::Caches->get_instance(); > $cache->clear_from_cache('libraries:name'); > } > > return $self; > } > >+=head2 delete >+ >+Library specific C<delete> to clear relevant caches on delete. >+ >+=cut >+ >+sub delete { >+ my $self = shift @_; >+ $cache->clear_from_cache('libraries:name'); >+ $self->SUPER::delete(@_); >+} >+ > =head3 stockrotationstages > > my $stages = Koha::Library->stockrotationstages; >diff --git a/Koha/Localization.pm b/Koha/Localization.pm >index 790c8729b4..6f1fef6440 100644 >--- a/Koha/Localization.pm >+++ b/Koha/Localization.pm >@@ -20,6 +20,8 @@ use Modern::Perl; > use Koha::Database; > > use base qw(Koha::Object); >+ >+my $cache = Koha::Caches->get_instance(); > > =head1 NAME > >@@ -42,7 +44,6 @@ sub store { > $self = $self->SUPER::store; > > if ($self->entity eq 'itemtypes') { >- my $cache = Koha::Caches->get_instance(); > my $key = "itemtype:description:".$self->lang; > $cache->clear_from_cache($key); > } >@@ -50,6 +51,21 @@ sub store { > return $self; > } > >+=head2 delete >+ >+Localization specific C<delete> to clear relevant caches on delete. >+ >+=cut >+ >+sub delete { >+ my $self = shift @_; >+ if ($self->entity eq 'itemtypes') { >+ my $key = "itemtype:description:".$self->lang; >+ $cache->clear_from_cache($key); >+ } >+ $self->SUPER::delete(@_); >+} >+ > sub _type { > return 'Localization'; > } >-- >2.39.2
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 30920
:
135771
|
136292
|
136293
|
144817
|
144818
|
144819
|
148064
|
148065
|
148066
|
148067
|
148087
|
148088
|
148089
|
148090
|
148091
| 148092 |
148093
|
148094