-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor Clear/Purge/Wipe #351
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…_files_from_host_cache_dir()`, `purge_files_from_host_cache_dir()`, `delete_files_from_host_cache_dir()`, `delete_all_files_dirs_in()`. See: #288
… occurs whenever a full clear is done; e.g. when a site owner clears the cache on their own. See: #288
@jaswsinc Wow! This is fantastic. Really great work. Thank you so much for all of this. I have reviewed your notes and merged this PR and PR wpsharks/comet-cache-pro#90. |
Next release changelog:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See also: #288
Summary of New Class Members
\quick_cache\share::CACHE_PATH_REGEX_DEFAULT_SUFFIX_FRAG
\quick_cache\share::$name
= (string)Quick Cache
\quick_cache\share::$short_name
= (string)QC
\quick_cache\share::$slug
(moved into the share class, was in the plugin class).\quick_cache\share::build_cache_path_regex()
- utility.\quick_cache\share::clear_files_from_cache_dir()
- simple wrapper.\quick_cache\share::purge_files_from_cache_dir()
- simple wrapper.\quick_cache\share::delete_files_from_cache_dir()
- a meaty routine.\quick_cache\share::build_host_cache_path_regex()
- utility.\quick_cache\share::build_host_cache_path_regex_frags_from_wc_uris()
- utility.\quick_cache\share::clear_files_from_host_cache_dir()
- simple wrapper.\quick_cache\share::purge_files_from_host_cache_dir()
- simple wrapper.\quick_cache\share::delete_files_from_host_cache_dir()
- a meaty routine.\quick_cache\share::delete_all_files_dirs_in()
- a meaty routine.\quick_cache\share::i18n_files()
- utility.\quick_cache\share::i18n_dirs()
- utility.\quick_cache\share::i18n_files_dirs()
- utility.\quick_cache\share::str_replace_once()
- utility.\quick_cache\share::str_ireplace_once()
- utility.\quick_cache\share::add_tmp_suffix()
- utility.\quick_cache\version_specific_upgrade::from_lt_v141009()
- handles option key changes.Summary of Changes
\quick_cache\plugin::auto_purge_*()
methods. These now take advantage of the new methods in the\quick_cache\share
class. Clearing/purging/wiping is now atomic in all scenarios.\quick_cache\plugin::auto_purge_*
methods, giving them the proper prefix ofauto_clear_*
instead. Along with this, all of theauto_purge_
option keys have been renamed as well. In addition, the UI, descriptions, internal coments, docBlocks, etc. have been updated to the correct terminology.\quick_cache\advanced_cache\maybe_invalidate_when_logged_in_postload()
to take advantage of new methods in the\quick_cache\share
class. Clearing (i.e. invalidation) is now atomic here as well.auto_purge_author_page_cache()
method (nowauto_clear_author_page_cache()
) was presenting dashboard notices in the pro version, even whenchange_notifications_enable
was off.auto_purge_custom_post_type_archive_cache()
method (nowauto_clear_custom_post_type_archive_cache()
) was not checking for the$post_id
in$this->static[__FUNCTION__]
. Should be$this->static[__FUNCTION__][$post_id]
./includes/utils-feed.php
) was added while I was working to refactor the XML feed clearing routine. With these utilities in place, theauto_clear_xml_feeds_cache()
method is now MUCH easier to deal with and comprehend.@TODO @raamdev
notes in the source code for review at a later date.\quick_cache\plugin::wipe_*()
and\quick_cache\plugin::clear_*()
methods. These now take advantage of new methods in the\quick_cache\share
class. As mentioned previously, all clearing/purging/wiping is atomic, and that includes these methods too. This work was actually done together with other changes to theauto_*()
methods.Performance Enhancements
scheme
sub-directory; i.e./http/
and/https/
is scanned separately to help break apart what was previously a much larger directory scan for sites that serve pages over both schemes. QC now does two scans, which in itself is a bit slower, but should actually work to improve performance overall. In short, we don't need to look at both variations of a site at the same time any longer, we now deal with clearing/purging for each scheme separately. This will improve performance on both standard and MS network installs.Tests Performed
auto_clear_*()
methods, along with various other things in both a standard WP install, and also on a MS network running sub-directories. Found a few minor issues and those were corrected in the last commit on this PR. Not seeing any remaining problems. I feel like this is ready to review; i.e. ready to merge and be tested further.