-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify caching of status checks #17817
Conversation
(Standard links)
|
Ping @eileenmcnaughton |
@colemanw I can see it was broken but I don't think I get why we ditched civi::cache: "If we did write to Civi::cache there is no mechanism for clearing that cache when data changes." Isn't the point that it is cached for a period of time & then it ages out? This doesn't seem more change prone than 'anything else' |
I think testing caching is crazy difficult and at this level it doesn't make sense |
I'm not sure I can be said to be ditching it here as it wasn't actually getting used in the first place. We pretty much use |
@colemanw since the cache system got improved we've been using it more - using a 'fastArray' cache means a static cache sits in front of 'the other' cache - so for Redis there is no DB query at all & once retrieved you still get the benefits of array caching. Generally I have been using civi::cache('metadata') for all not-constantly-changing stuff - contact types, membership types, price sets etc |
I'd be worried about time-based caching causing bugs here, as these settings can be changed & then the cached data would be wrong. IMO if we're going to use a cache we'd also need to clear it in the StatusPref BAO for every write operation. |
138e525
to
580ae08
Compare
@eileenmcnaughton looking at this again, I found an actual bug: So now that this PR fixes a real bug and simplifies things in general, can we go ahead and merge this first and then take a look at the caching issue second |
Test fail is unrelated |
@colemanw - File conflicts |
Fixes a few apparent problems: - domain_id was ommitted causing unexpected results - Civi::cache was being read but never written to - Object caching did not persist in memory across different check classes - If we did write to Civi::cache there is no mechanism for clearing that cache when data changes Solution: use simple array cache in Civi::$statics
580ae08
to
1416a3c
Compare
OK - I'm not convinced about reducing our caching - but this should be a cheap call |
Overview
Simplifies code and improves performance during system status checks.
Before
'domain_id'
was missing from the api params, which would have caused unexpected results and possibly crashes in multi-site setups.Civi::cache
was being read but never written to.CRM_Utils_Check_Component_*
class).Civi::cache
there is no mechanism for clearing that cache when data changes.After
Solution: use simple array cache a-la Civi::$statics