[Koha-bugs] [Bug 32894] Objects cache methods' result without invalidation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 10 06:26:04 CEST 2023


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

--- Comment #33 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to Kyle M Hall from comment #32)
> I do not think this is a great idea long term. This is moving backwards when
> it comes to efficiency and will introduce far more database calls. It seems
> like it might be better to fix the code that is making a bad assumption. The
> short term fix is to use discard_changes when needed. The long term fix is
> to use Koha objects from the perl scripts and pass them to subroutines so we
> have no need to re-fetch data from the database.
> 
> Have you identified any bugs being caused by this, or it just a possibility
> as you've shown?

This is a bad pattern, we should get rid of it and prevent it from propagating
over the codebase.

The correct way to fix the refetch is patch like bug 32496 and bug 31735.

There is also bug 32476 that can be helpful to cache *calculated* values when
specific performance problems are identified.

Here we are caching only 1 DB call that is already cached by an underlying
mechanism anyway (DBMS or DBIC).

> It seems like it might be better to fix the code that is making a bad assumption.

No need to make bad assumption to get incorrect results, see comment 0.

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


More information about the Koha-bugs mailing list