• abhishekgoyal

    (@abhishekgoyal)


    I can access all the settings of Cloudflare in my WordPress directly, perfect. Now what? How can I get benefit from your plugin? Only feature I found useful is Guest Caching. That will only be useful if you can give a “purge cache” option on per post basis. Purging the whole cache is not useful as a plugin. It would be really great if you can give an option which detects any new post/images and other changes and purge the specific cache automatically. A purge option in each post will also do the job for now. I will wait for the update. Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author digitalpoint

    (@digitalpoint)

    It actually does work exactly how you suggest already. While the manual Purge Cache option will indeed purge the entire cache, under normal circumstances it’s not needed unless you are doing development work or changing themes, internally it automatically purges a selective subset of pages if necessary, automatically.

    For example if you create a new post, the pages that post can potentially be displayed on are purged. If a comment is made on a post, the URLs for that post wll be purged, etc. It automatically handles purging of individual archive pages, RSS feeds, etc, it handles if a post changes status (like is unapproved), etc.

    If you are so inclined you can see how it handles automatic purging and what it decides to purge: https://plugins.trac.www.ads-software.com/browser/app-for-cf/tags/1.7.6/src/DigitalPoint/Cloudflare/Base/Pub.php?rev=2982349#L198

    Thread Starter abhishekgoyal

    (@abhishekgoyal)

    Oh I see. I also checked the code. Could you tell me why only I can see the updated changes as admin but not in other devices or browsers? Even if I clear entire browser cache, it shows old cached pages. It only shows the updated pages once I purge the entire cache.

    Plugin Author digitalpoint

    (@digitalpoint)

    It’s hard to say without knowing the site, what other plugins you have installed and not being able to test it firsthand.

    Without knowing anything, a good thing to look at would be to see if you have another caching layer/mechanism in place (maybe a caching plugin or possibly something at the server-level like Varnish). It’s quite possible something else might be generating it’s own cache that isn’t being purged appropriately.

    FWIW, I did just double check to make sure the mechanism in this plugin is working as expected and it is. I visited the site as a guest/Incognito window, could see it hitting Cloudflare’s cache, then edited the post in another window logged in as someone that had the permissions to do so and saved it. The change was immediately available to the guest user on a reload, so it does appear to be working as expected.

    But ya… I’d maybe see if there’s another caching layer/mechanism/plugin that might be acting less smart about selective cache purging. This addon only purges it from the network Edge (Cloudflare), so it will make the request back to your origin server. If your origin server is serving up something cached, it’s only going to be as fresh as that.

    Thread Starter abhishekgoyal

    (@abhishekgoyal)

    I have checked but no other cache plugin/mechanism active. Also as I said when I purge the entire cache from Edge Cloudflare, it shows the updated page. This means this is not related with origin server but with Cloudflare only.

    But I found something which may help us to solve the problem.
    When I update the post (it is a custom post type), I can see the updated values on the homepage but not on the post itself.

    I also tried modifying a category name but it didn’t reflected in guest tab.

    My random guess is that it is not working because of custom slugs.

    Edit: Normal posts are updating properly, it is because of custom post types (or custom slugs too)

    Plugin Author digitalpoint

    (@digitalpoint)

    Changing the slug of an already existing category intentionally doesn’t trigger a purge because there’s the potential for a TON of URL changes. If that were to be done automatically, it would make more sense to do a complete site purge because the purgeCache API call has a limit of 30 URLs per call. So if you assembled a list of URLs to purge, it could easily get into the thousands of URLs that would then need to be broken down into multiple API requests (since you can’t do more than 30 per request). At the same time, you probably don’t want to do a full site purge automatically because that’s just not a good idea in any case to be doing it automatically. So for an edge case where you are changing the slug of an existing category, it probably makes sense to let the user pick between manually purging the cache for the whole site or don’t and let the cache expire after a couple hours (whatever they have the guest page expiration set to).

    As far as “custom slugs”, if it’s just the normal function WordPress gives you to change the slug of a post to anything you want, it should work as expected (I just tested it and confirmed it is on my end) as it’s using standard WordPress function to get the permalink for the post (specifically get_permalink($postId)).

    Now if you have a completely custom system for generating URLs that is outside the standard WordPress functions, I did add a WordPress filter that would allow you to hook into the list of URLs about to be purged to make modifications to that list. That filter is: cloudflare_purge_by_url

    Thread Starter abhishekgoyal

    (@abhishekgoyal)

    I found the problem, it is with custom slugs function I copied from stackexchange (https://wordpress.stackexchange.com/a/282040)

    Thanks for this great plugin.

    Plugin Author digitalpoint

    (@digitalpoint)

    Great! I hate when something can’t be solved/figured out. ??

    As I mentioned in the previous message there is already a filter I put in place for cases like that in case you want to edit the list of URLs the addon compiled for purging. So in your case you could use that filter to add some extra URLs to that list (if you wanted).

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Perfect!!’ is closed to new replies.