Skip to content
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

Improve caching of current domain #17916

Merged
merged 2 commits into from
Jul 23, 2020
Merged

Conversation

colemanw
Copy link
Member

Overview

The current domain is read dozens, sometimes hundreds of times per request, so it needs to have solid caching. This consolidates 4 different ways it was being cached (or in the case of api3, not cached) into one central spot.

Before

Current domain cached during bootstrap but never flushed in the event of changes.
Several other methods of reading the domain were used that bypassed that cache or used some other cache.

After

All centralized to one cache, which is automatically flushed by hook whenever updates are made (which is rare but important to respond to, and essential for unit tests)

@civibot
Copy link

civibot bot commented Jul 22, 2020

(Standard links)

@civibot civibot bot added the master label Jul 22, 2020
@demeritcowboy
Copy link
Contributor

Gave the code a read-over and poked around a bit with a single-domain english-single-language setup. So not a full thumbs up but so far so good.

The postSave took me a minute but I'm reading it as not adding a new hook, but implementing the hook within core itself.

@seamuslee001
Copy link
Contributor

I believe we have plenty of test coverage here that if something was to break it should show up in the test coverage merging

@seamuslee001 seamuslee001 merged commit a6fdf34 into civicrm:master Jul 23, 2020
@seamuslee001 seamuslee001 deleted the domainCache branch July 23, 2020 02:43
@colemanw
Copy link
Member Author

The postSave took me a minute but I'm reading it as not adding a new hook, but implementing the hook within core itself.

Yes @demeritcowboy the way to implement a hook callback internally is by adding a listener.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants