From d7cc105db8adf1569ba4d41403be1e707c9b569f Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 15 Nov 2024 11:24:17 +0100 Subject: [PATCH] Bug 38454: Flush memory cache before every API request --- Koha/REST/V1.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index 469e755da0..9ee52adde9 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -62,6 +62,17 @@ sub startup { if C4::Context->preference('AccessControlAllowOrigin'); } ); + $self->hook( + around_action => sub { + my ($next, $c, $action, $last) = @_; + + # Flush memory caches before every request + Koha::Caches->flush_L1_caches(); + Koha::Cache::Memory::Lite->flush(); + + return $next->(); + } + ); # Force charset=utf8 in Content-Type header for JSON responses $self->types->type( json => 'application/json; charset=utf8' ); -- 2.39.2