[Koha-bugs] [Bug 32476] Add caching for relatively expensive patron methods
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Dec 15 23:55:19 CET 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32476
David Cook <dcook at prosentient.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcook at prosentient.com.au
--- Comment #3 from David Cook <dcook at prosentient.com.au> ---
I like the idea of this one, although I wonder if the cache could be more
generalizable and have less repeated code.
--
Koha::Object could create $self->{_cache} = {} in the new() constructor.
Then Koha::Patron could use a cache related function at the start and end of
"is_expired" and "has_overdues":
return $self->cache({ key => 'is_expired' }) if $param->{cache};
$param->{cache} ? $self->cache({ key => 'is_expired', value => $is_expired }) :
$self->cache({ key => 'is_expired', value => undef });
Not saying it has to... but just a thought to make things easier to read, test,
and maintain.
--
I wonder if Koha::Cache::Memory::Lite could be used instead as well.
--
Overall, I'm a big fan of caching and not re-fetching data that we've already
fetched.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list