Split checking of static cache vs getting it #3255
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.