[Koha-bugs] [Bug 26587] detail.pl is very slow for records with many items

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 29 07:16:02 CEST 2021


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

--- Comment #3 from David Cook <dcook at prosentient.com.au> ---
(In reply to Björn Nylén from comment #2)
> We've been profiling a bit and fond that the Branches template plugin is a
> culprit. GetName does a db-call every time. Tried caching the values in a
> package variable which cut down the time considerably. Not sure if "our"
> variables are kosher though?

Nice one, Björn!

I haven't played around with the Template Toolkit plugins much, but according
to http://template-toolkit.org/docs/modules/Template/Plugin.html, it looks like
the Branches plugin is used as an object.

So in terms of scoping...

If you cache it with the object, I imagine it would be cached just for the
lifetime of that request.

If you cache it at the package level, you'd cache it for the life of that Plack
worker process, which could possibly be problematic. 

You could also use Koha::Cache, although I'm not sure that it lets you only
cache it locally and not within Memcached. 

The easiest thing would probably be to create a hashmap in $self->{branches}
where $branchcode is the key and the value is a Koha::Library object. 

That should limit the database calls while also keeping things quite fresh.

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


More information about the Koha-bugs mailing list