[Koha-bugs] [Bug 18821] TrackLastPatronActivity is a performance killer

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 25 16:31:34 CEST 2018


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

--- Comment #31 from Kyle M Hall <kyle at bywatersolutions.com> ---
> What happens? Somehow $session is already undef when you call track. If we
> need to call CGI::Session->new($sessionID) each time, we do not really
> benefit in terms of db access (well: 1 lookup in sessions instead of 1 in
> borrowers).

That would at least be changing from 1 write to 1 read, which is definitely an
improvement, right?

> Is there a different approach? What about using a cache key? (Do we want to
> pollute the cache with keys for every session..)

So you're suggesting storing something like

--
my $cache = Koha::Caches->get_instance();
my $cache_key = "seen-for-session-$borrowernumber";
my $cached = $cache->get_from_cache($cache_key, { unsafe => 1});
unless ( $cached ) {
  $patron->track_login;
  $cache->set_in_cache($cache_key, 1);
}
--

If so, I think that works! Let me know and I'll submit a patch.

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


More information about the Koha-bugs mailing list