[Koha-bugs] [Bug 17941] CanBookBeRenewed is very inefficient/slow

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 1 15:24:40 CET 2017


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

--- Comment #5 from Petter Goksøyr Åsen <boutrosboutrosboutros at gmail.com> ---
(In reply to Jonathan Druart from comment #4)

> No do not wait, release as soon as you can :)

OK, for the adventurous:
https://gist.github.com/boutros/c3a63904c788d0a6336023042ce22cde

We recently hired a very experienced Perl guy, so he's behind this, not me:)
But it's very simple actually: just by decorating subroutines with ":
PureFunction" - you get memoization for free!

The actuall PureFunctions module is maybe not for the faint of heart, but it's
very small, and I do belive it works out very beautifull. And as this is not a
persistent cache, but only valid during the scope of the request, we don't have
to deal with cache invalidation and such problems.

The solution can easily be extended to other Getter-methods, as long as they
are idempotent (which they should be).

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


More information about the Koha-bugs mailing list