[Koha-bugs] [Bug 29623] Cache circulation rules

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 1 02:53:53 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29623

--- Comment #18 from David Cook <dcook at prosentient.com.au> ---
(In reply to Jonathan Druart from comment #15)
> I think this is the correct approach, what do you think?

I'm not 100% sure. 

I find that the code in ./admin/smart-rules.pl and Koha/CirculationsRules.pm is
very messy.

If we clear the cache after each set_rule() call, we'll be calling the function
~38 times (so 38 loops) for each add/update/delete in ./admin/smart-rules.pl.
We should only need to call it 1 time for each CRUD operation.

In terms of core code, it looks like Koha::CirculationRules->set_rule only gets
called in Koha/CirculationRules.pm and once accidentally in
./admin/smart-rules.pl (it should use set_rules instead). We do call set_rule()
a lot in the unit tests though. 

I suppose occasional inefficient cache setting/clearing in
./admin/smart-rules.pl is worth a performance speed up during frequent
transactional work. 

In fact, since we're using the L1 cache and the L1 cache is flushed at the end
of every HTTP/SIP request, clearing the cache (in ./admin/smart-rules.pl) is
actually probably totally unnecessary for production purposes. 

The only time caching of circulation rules would be a potential problem is in
the unit tests. 

So I'd say the cache clearing is messy but it's good enough. 

(Side note: the circulation_rules table has an "id" column, so we should be
using that for for distinct update_rules/delete_rules operations.)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list