keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

update cache clearing and advcache settings #99

Closed coreykn closed 4 years ago

coreykn commented 4 years ago

Merge Cache_Enabler::process_clear_request_url() with Cache_Enabler::clear_page_cache_by_url(). Unsure why I added this new method in PR #98 when it would be better to check the URL when clearing the cache by URL instead. This is better because it ensures the complete cache is not cleared if the home page URL is cleared. This fixes the issue where the complete cache was cleared if the post ID passed in Cache_Enabler::clear_page_cache_by_post_id() was the home page.

Split Cache_Enabler::handle_trailing_slash() into Cache_Enabler::_bypass_cache_for_trailing_slash() (new) and Cache_Enabler::validate_settings() (existing) to avoid updating the advanced cache settings file(s) unnecessarily (#97). Add Cache_Enabler::permalink_structure_has_trailing_slash() to check if the permalink structure has a trailing slash.

Update Cache_Enabler::handle_cache(). Move checking if the trailing slash should be bypassed to Cache_Enabler::_bypass_cache() instead to run all bypass checks in one method.

Closes #97