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> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
7d9d795669
commit
f716438555
5 changed files with 76 additions and 7 deletions
|
@ -24,6 +24,8 @@ use Koha::Database;
|
||||||
|
|
||||||
use base qw(Koha::Object Koha::Object::Limit::Library);
|
use base qw(Koha::Object Koha::Object::Limit::Library);
|
||||||
|
|
||||||
|
my $cache = Koha::Caches->get_instance();
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::AuthorisedValue - Koha Authorised value Object class
|
Koha::AuthorisedValue - Koha Authorised value Object class
|
||||||
|
@ -61,14 +63,26 @@ sub store {
|
||||||
$self = $self->SUPER::store;
|
$self = $self->SUPER::store;
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
my $cache = Koha::Caches->get_instance();
|
my $key = "AV_descriptions:".$self->category;
|
||||||
my $key = "AVDescriptions-".$self->category;
|
|
||||||
$cache->clear_from_cache($key);
|
$cache->clear_from_cache($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self;
|
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
|
=head3 opac_description
|
||||||
|
|
||||||
my $description = $av->opac_description();
|
my $description = $av->opac_description();
|
||||||
|
|
|
@ -22,6 +22,8 @@ use Koha::Database;
|
||||||
|
|
||||||
use base qw(Koha::Object);
|
use base qw(Koha::Object);
|
||||||
|
|
||||||
|
my $cache = Koha::Caches->get_instance();
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::ClassSource - Koha Classfication Source Object class
|
Koha::ClassSource - Koha Classfication Source Object class
|
||||||
|
@ -52,13 +54,24 @@ sub store {
|
||||||
$self = $self->SUPER::store;
|
$self = $self->SUPER::store;
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
my $cache = Koha::Caches->get_instance();
|
$cache->clear_from_cache('cn_sources:description');
|
||||||
$cache->clear_from_cache('cn)sources:description');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self;
|
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
|
=head3 _type
|
||||||
|
|
||||||
Returns name of corresponding DBIC resultset
|
Returns name of corresponding DBIC resultset
|
||||||
|
|
|
@ -27,6 +27,8 @@ use Koha::Localizations;
|
||||||
|
|
||||||
use base qw(Koha::Object Koha::Object::Limit::Library);
|
use base qw(Koha::Object Koha::Object::Limit::Library);
|
||||||
|
|
||||||
|
my $cache = Koha::Caches->get_instance();
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::ItemType - Koha Item type Object class
|
Koha::ItemType - Koha Item type Object class
|
||||||
|
@ -59,7 +61,6 @@ sub store {
|
||||||
$self = $self->SUPER::store;
|
$self = $self->SUPER::store;
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
my $cache = Koha::Caches->get_instance();
|
|
||||||
my $key = "itemtype:description:en";
|
my $key = "itemtype:description:en";
|
||||||
$cache->clear_from_cache($key);
|
$cache->clear_from_cache($key);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,18 @@ sub store {
|
||||||
return $self;
|
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
|
=head3 image_location
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
|
@ -29,6 +29,8 @@ use Koha::SMTP::Servers;
|
||||||
|
|
||||||
use base qw(Koha::Object);
|
use base qw(Koha::Object);
|
||||||
|
|
||||||
|
my $cache = Koha::Caches->get_instance();
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::Library - Koha Library Object class
|
Koha::Library - Koha Library Object class
|
||||||
|
@ -59,13 +61,24 @@ sub store {
|
||||||
$self = $self->SUPER::store;
|
$self = $self->SUPER::store;
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
my $cache = Koha::Caches->get_instance();
|
|
||||||
$cache->clear_from_cache('libraries:name');
|
$cache->clear_from_cache('libraries:name');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self;
|
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
|
=head3 stockrotationstages
|
||||||
|
|
||||||
my $stages = Koha::Library->stockrotationstages;
|
my $stages = Koha::Library->stockrotationstages;
|
||||||
|
|
|
@ -21,6 +21,8 @@ use Koha::Database;
|
||||||
|
|
||||||
use base qw(Koha::Object);
|
use base qw(Koha::Object);
|
||||||
|
|
||||||
|
my $cache = Koha::Caches->get_instance();
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::Localization - Koha Localization type Object class
|
Koha::Localization - Koha Localization type Object class
|
||||||
|
@ -42,7 +44,6 @@ sub store {
|
||||||
$self = $self->SUPER::store;
|
$self = $self->SUPER::store;
|
||||||
|
|
||||||
if ($self->entity eq 'itemtypes') {
|
if ($self->entity eq 'itemtypes') {
|
||||||
my $cache = Koha::Caches->get_instance();
|
|
||||||
my $key = "itemtype:description:".$self->lang;
|
my $key = "itemtype:description:".$self->lang;
|
||||||
$cache->clear_from_cache($key);
|
$cache->clear_from_cache($key);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +51,21 @@ sub store {
|
||||||
return $self;
|
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 {
|
sub _type {
|
||||||
return 'Localization';
|
return 'Localization';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue