https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26587
--- Comment #3 from David Cook <[email protected]> --- (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. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
