-
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
Feature Request: Option to disable caching for Home Page / Posts Page #191
Comments
Feature requested here: http://wordpress.org/support/topic/how-can-i-have-it-not-cache-the-blog-page |
Another way you could do this is from the if(preg_match('/^\/(index\.php\/?)?(\?|$)/', $_SERVER['REQUEST_URI']))
define('ZENCACHE_ALLOWED', FALSE); // Don't cache home page. This could also be done via I think it would be good for us to support a raw regex pattern in the list of URI/Referer/User-Agent exclusions where we currently support only the The default pattern matching is more of an |
Actually, I just remembered that this constant could also be configured manually if you prefer. So this is also possible using the Put the following into your define('ZENCACHE_EXCLUDE_URIS', '/^\/(index\.php\/?)?(\?|$)/'); |
A more simplified variation, this doesn't cover as many edge cases. define('ZENCACHE_EXCLUDE_URIS', '/^\/(\?|$)/'); |
Noting that I had two requests for this feature today via ZenCache Pro support. |
I agree. I saw a ticket about this earlier in ZenDesk and left a private comment there, not remembering that we had an open issue about it also. I think a possible solution here is to allow for the I really hate to enable regex in that field though, as it is likely to cause more confusion. The current implementation uses more of an What's the right solution? Not sure. If we add support for One example that comes to mind, is for the home page. If we make it possible to do this, in order to exclude the home page: |
I see two possible routes here:
I'm in favor of the latter, but I wonder how much extra work that would be in the code. |
I like that idea too. Great! I see both of these as being the same amount of work, but the latter being a little easier, since it will not require any changes to the existing pattern-matching routine. The current implementation converts the simplified patterns into regex anyway, so we'd just need to add the additional option keys, the UI components, and then merge the new patterns into the array before running the conditionals; i.e. |
Great! I'll keep this feature request in mind during the triage phase of a future development cycle. :) |
This feature was requested here: https://wordpress.org/support/topic/how-to-stop-index-cache-page |
Next Actions (Step 1 of 2)Referencing: https://gist.github.com/jaswsinc/8dedeb364a010ccdd8d0 and https://github.com/websharks/team/issues/29
|
Next Actions (Step 2 of 2)
|
@kristineds While working on this issue you can take note of what Regex is and why it is a crucial piece of the puzzle whenever you are working to enhance your skills as a developer. Regular Expressions are a language of their own, but they are vital in almost every programming language that deals with string manipulation; i.e., almost all of them.
We deal almost exclusively with PCRE (Perl-Compatible Regular Expressions). So whenever you seek information to help you write regex patterns and/or understand what you're looking at, you can put your focus on articles that discuss PHP's Once you understand PCRE and how to work with regex in PHP, you'll have no trouble adapting that knowledge whenever you work in JavaScript, Ruby, Python, etc.. Referencing: http://php.net/manual/en/ref.pcre.php The most important PCRE functions in PHP are: |
@kristineds Ping. ↑ Just wondering when you'll be able to get around to submitting a PR for step 2 above so that I can close this issue before the next release RC deadline of October 22nd. |
@raamdev I just submitted the PR for step 2. Please refer to the latest commit for the updated version. Would love to hear your feedback on this and how to proceed. Thanks! cc @jaswsinc |
Next Pro Release Changelog:
|
ZenCache v151114 has been released and includes changes from this GitHub Issue. See the v151114 announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#191). |
It would be nice if there was a simple option to disable caching for the Home Page and/or the Posts page, if a site owner wanted to that.
Excluding the Home Page from the cache is not currently possible without manually adding PHP code to the theme template to define
DONOTCACHEPAGE
. Using the URI Exclusions Feature wouldn't work because the exclusion pattern of/
would exclude everything on the site.The text was updated successfully, but these errors were encountered: