@@ -, +, @@ --- Koha/Cache/Memory/Lite.pm | 5 +++++ Koha/CirculationRules.pm | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) --- a/Koha/Cache/Memory/Lite.pm +++ a/Koha/Cache/Memory/Lite.pm @@ -64,6 +64,11 @@ sub clear_from_cache { delete $L1_cache{$key}; } +sub all_keys { + my ( $self ) = @_; + return keys %L1_cache; +} + sub flush { my ( $self ) = @_; %L1_cache = (); --- a/Koha/CirculationRules.pm +++ a/Koha/CirculationRules.pm @@ -377,10 +377,9 @@ sub set_rule { } my $memory_cache = Koha::Cache::Memory::Lite->get_instance; - my $cache_key = sprintf "CircRules:%s:%s:%s:%s", $rule_name // q{}, - $categorycode // q{}, $branchcode // q{}, $itemtype // q{}; - - Koha::Cache::Memory::Lite->flush(); + for my $k ( $memory_cache->all_keys ) { + $memory_cache->clear_from_cache($k) if $k =~ m{^CircRules:}; + } return $rule; } @@ -410,7 +409,6 @@ sub set_rules { push( @$rule_objects, $rule_object ); } - Koha::Cache::Memory::Lite->flush(); return $rule_objects; } --