Bugzilla – Attachment 79648 Details for
Bug 20582
Turn Koha into a Mojolicious application
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20582: Fix memory cache flush
Bug-20582-Fix-memory-cache-flush.patch (text/plain), 1.62 KB, created by
Julian Maurice
on 2018-09-30 09:14:40 UTC
(
hide
)
Description:
Bug 20582: Fix memory cache flush
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-09-30 09:14:40 UTC
Size:
1.62 KB
patch
obsolete
>From cbd38632e8b24700fb1880e0fe15b2c59f9a81a1 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Sun, 30 Sep 2018 11:14:09 +0200 >Subject: [PATCH] Bug 20582: Fix memory cache flush > >Cache flush should be in around_action hook instead of before_dispatch >Otherwise it is flushed before every request (even static files >requests) >Also, make sure the Cache::Memory cache is really flushed (not only L1 >cache) >--- > Koha/App/Koha.pm | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > >diff --git a/Koha/App/Koha.pm b/Koha/App/Koha.pm >index 6e47272a81..529da44247 100644 >--- a/Koha/App/Koha.pm >+++ b/Koha/App/Koha.pm >@@ -22,6 +22,7 @@ sub startup { > $self->plugin('RESTV1'); > > $self->hook(before_dispatch => \&_before_dispatch); >+ $self->hook(around_action => \&_around_action); > > # Everything after this comment is only needed to use Mojolicious > # controllers. >@@ -55,9 +56,26 @@ sub _before_dispatch { > > $c->req->url->parse($url); > >- # Flush caches before every request >- Koha::Caches->flush_L1_caches(); >+} >+ >+sub _around_action { >+ my ($next, $c, $action, $last) = @_; >+ >+ # Flush memory caches before every request >+ my $caches = $Koha::Caches::singleton_caches; >+ if ($caches) { >+ foreach my $key (keys %$caches) { >+ my $cache = $caches->{$key}; >+ if (ref $cache->{cache} eq 'Cache::Memory') { >+ $cache->flush_all; >+ } >+ $cache->flush_L1_cache; >+ } >+ } >+ $Koha::Caches::singleton_caches = {}; > Koha::Cache::Memory::Lite->flush(); >+ >+ return $next->(); > } > > 1; >-- >2.17.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 20582
:
74173
|
74517
|
74518
|
74519
|
74520
|
79648
|
81687
|
81857
|
82423
|
84526
|
84527
|
84528
|
84529
|
84530
|
84531
|
91009
|
99267
|
103633
|
103720
|
103721
|
109282
|
109283
|
109284
|
109895
|
109896
|
109897
|
109898
|
109899
|
109900
|
111282
|
111315
|
111374