[Koha-bugs] [Bug 16044] Define a L1 cache for all objects set in cache

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Mar 15 09:41:44 CET 2016


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

--- Comment #5 from Jacek Ablewicz <abl at biblos.pk.edu.pl> ---
To clarify comment #1: I don't think it's a bad idea; on the contrary, I think
it's an excellent idea! But I also think that current/initial implementation
is, again, inherently dangerous. IMO it should at least have some basic safety
measures built-in to be (reasonably) safe. I dunno, something simple.. e.g -
let's have two variants of ->get_from_cache():

1) get_from_cache():
   - if the cached thingy in L1 cache is a scalar - just return it, no problems
whatsoever
   - if it's a reference, return a "deep clone" of what we keep in L1 cache in
deserialized form (that should still be way faster than fetching it from the
network and deserializing it each and every time)

2) get_from_cache_just_gimme_a_raw_reference_I_know_what_I_am_doing()
   - initial/ultra-fast implementation which just returns references directly

Having two variants of get_from_cache() is not very elegant at the 1st glance,
but it's the fastest and simplest method I can imagine:

- it's faster than (e.g.) handling some extra parameters inside
one-to-rule-them-all get_from_cache() subroutine - sooner or later some scripts
will be calling that sub 10000+ times, and such (seemingly very small)
overheads have a nasty tendency to add up
- it will allow us to introduce "I know what I'm doing / I like to live
dangerously" variant selectivelly and gradually - preferably, in the separate
bug reports, so if something somwhere explodes due to using the
ultra-fast-but-not-always-safe caching method, it will be a lot easier to
fix/revert it selectivelly without killing performance of the entire caching
system

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


More information about the Koha-bugs mailing list