• Resolved robwent

    (@robwent)


    Hi,

    I have a site which creates pages using a rewrite rule, with information from an API.

    When the information in the API changes, I try to purge the cache for the current page, but it doesn’t work.

    If I purge all page cache then the cached files get the _old suffix and it gets cleared.

    So, my question is, does the purge current page admin toolbar option work by clearing the cache by post ID, or URL?

    If it’s by ID, is there a way for me to trigger a single page cache deletion when the content of the API changes?

    Thanks for any insights!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @robwent

    Thank you for reaching out and I am happy to assist you with this.
    Are you using the Top admin bar and hovering over Performance and clicking Purge current page?
    Do you have the ?w3tc_note=pgcache_purge_post added to the URL once the action is completed?

    Thanks!

    Thread Starter robwent

    (@robwent)

    Yes, that’s the option I am trying to use.

    When I co=lick on it, I get ?w3tc_note=pgcache_purge_post added to the URL.

    If I test it on a normal WordPress page then the cached files change names from _index_slash_ssl.html and _index_slash_ssl.html_gzip to _index_slash_ssl.html_gzip_old and _index_slash_ssl.html_old then new files are generated the next time a guest visits the page.

    When I try it on a non-WordPress//API generated page, I still get the ?w3tc_note=pgcache_purge_post added to the url, but the file names don’t change and don’t get deleted, so the cache is not cleared.

    This is why I was asking if the purge current page option uses the WordPress ID of the current page rather than the URL to change the files. Since the generated pages don’t come from the database, they have no real ID to use.

    If that’s the case, are there any functions/hooks/filters available to be able to clear the files by url?

    I should add that clicking the link to clear all page cache does work on these files and the filenames change, but we don’t really want to clear all cache when we just need to refresh a few pages.

    • This reply was modified 1 year, 10 months ago by robwent. Reason: Additional info
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @robwent

    Thank you for your feedback.
    Can you please try calling w3tc_flush_url($permalink)
    let me know if this helps!
    Thanks!

    Thread Starter robwent

    (@robwent)

    Yes!

    That’s perfect, thank you!

    Thread Starter robwent

    (@robwent)

    is there something similar to rebuild the cache?

    I’ve tried calling the page with curl using various useragents but it doesn’t get rebuilt.

    I’m assuming it’s possible as there is the option for preload via the sitemap. So that must be pinging the URLs somehow to rebuild the cache?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Purge cache of current page not working with dynamically created pages’ is closed to new replies.