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

--- Comment #30 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205223
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205223&action=edit
Bug 41714: (QA follow-up) Cache authority type framework mappings with
Koha::Cache::Memory::Lite

_load_authority_types_from_frameworks() cached the marc_subfield_structure
tag-to-authtype mapping in a plain process-lifetime lexical
(%authority_type_cache) with no way to invalidate it. Under Plack/mod_perl,
once a worker populated the cache, editing the Default framework's tag
links in the staff interface had no effect until that worker was restarted
- defeating the point of the LinkerUseFrameworkAuthTypes preference. The
QA review also found that the regression test's attempt to reset this
cache between assertions (%C4::Heading::authority_type_cache = ()) silently
did nothing, since that syntax refers to an unrelated package global, not
the `my` lexical actually used by the module - the test only passed
because it happened to be the first call to populate that cache key.

This switches the cache to Koha::Cache::Memory::Lite, the existing Koha
idiom for this kind of per-request lookup cache (as used by e.g.
Koha::CirculationRules): it still avoids a database round trip per heading
parsed, but is automatically flushed at the start of every request, so a
framework change made via the staff interface takes effect on the very
next request rather than requiring a process restart.

While touching this code, also replaces the raw $dbh->prepare/execute call
with Koha::MarcSubfieldStructures (the DBIx::Class accessor the tests
already use to set up the same data), removing the last piece of hand
rolled SQL from this new helper.

Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to