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

--- Comment #57 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 203159
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203159&action=edit
Bug 42310: (follow-up) Bake cache invalidation into Koha::Object classes

When using the new Koha::Calendar::* classes for writing the CRUD API
endpoints I noticed that in my attempt to keep C4::Calendar similar to what it
was, I ended up with cache invalidation not always done in the right place.

The holidays cache (keyed by {branchcode}_holidays) stores dates and their
open/closed status, not titles or descriptions. This means only inserts and
deletes need to invalidate it — metadata updates (title/description) do not.

Following the pattern established by Koha::AuthorisedValue and Koha::ItemType,
I added store() and delete() overrides to Koha::Calendar::SingleClosure and
Koha::Calendar::Exception:

- store() flushes the cache only on insert (!in_storage), not on updates,
  since the cache doesn't store titles or descriptions.
- delete() always flushes, since removing a closure changes the cached set.

This allowed removing the now-redundant _clear_cache calls from
Koha::Calendar::add_single_closure, add_exception, delete_single_closure,
delete_exception, and from C4::Calendar::ModSingleholiday and
ModExceptionholiday.

Signed-off-by: Tomás Cohen Arazi <[email protected]>
Signed-off-by: David Nind <[email protected]>
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