From 6c360763e80e9d85c11af4395778dca936e8850a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Mar 2016 20:47:47 +0000 Subject: [PATCH] Bug 16044: Populate the L1 cache when L2 is fetched The whole patch set is not very pertinent if the L1 cache is not populated when L2 is fetched! This patch fixes this inconsistency. Signed-off-by: Jesse Weaver Signed-off-by: Jacek Ablewicz Signed-off-by: Brendan A Gallagher (cherry picked from commit c75271a741632b4aa9af0c6c342cdbf1c77e699f) Signed-off-by: Julian Maurice --- Koha/Cache.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 0df003f9e5..f980da5247 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -315,7 +315,13 @@ sub get_from_cache { } my $get_sub = $self->{ref($self->{$cache}) . "_get"}; - return $get_sub ? $get_sub->($key) : $self->{$cache}->get($key); + my $value = $get_sub ? $get_sub->($key) : $self->{$cache}->get($key); + + # Update the L1 cache when fetching the L2 cache + # Otherwise the L1 cache won't ever be populated + $L1_cache{$key} = $value; + + return $value; } =head2 clear_from_cache -- 2.39.5