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

Split checking of static cache vs getting it #3255

Merged
merged 2 commits into from
Feb 16, 2021
Merged

Split checking of static cache vs getting it #3255

merged 2 commits into from
Feb 16, 2021

Conversation

jasonvarga
Copy link
Member

Fixes #3209

When a request is made, we get the cached response up front - if there is one, we'll use it.
It was done this way so there wouldn't be separate cache hits for checking and getting. The point of this feature is speed so every little bit helped. 😄

However, this causes a log when the page is generated in #3209.

This PR splits up checking for the existing cache vs. getting it. Checking the existing cache won't trigger a log.

For half measure, the overhead is now alleviated even with a separate "has" method by storing the cached value in a property.

For full measure, you'll have the same number of file operations as before.
Uncached pages get one for checking the cache, and another for writing it.
Cached pages with the server rewrite set up won't even hit PHP.
Cached pages with the server rewrite not set up will still see the cached page and get the speed, but also get the log.

This is very very sorta breaking because there's now a new method in the interface, but most of the time you'll be extending AbstractCacher or another existing driver, which both define it.

@jasonvarga jasonvarga changed the base branch from 3.0 to master February 16, 2021 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log Debug \Log::debug('Static cache loaded is out of control.
1 participant