• Resolved christopherreay

    (@christopherreay)


    Is there a URL I could call to cause Falcon to clear its cache?
    I could just make a page that does it myself I suppose.

    Would be useful, as someone said earlier, to be able to schedule clearing of the cache to keep up with “semi” dynamic content (trending or whatever)

    Also, I would love to have a conversation with you about extending the caching deeper into the wordpress core to enable more finegrained updates of cached files

    https://www.ads-software.com/plugins/wordfence/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WFMattR

    (@wfmattr)

    Falcon uses an ajax call to clear the cache, but it may be difficult to make it work when not logged in as an admin (like from a cron job).

    There are other events documented that will cause the cache to be cleared:
    https://docs.wordfence.com/en/Falcon_Cache#Events_that_cause_the_Falcon_Cache_to_auto-clear

    For your other feedback and ideas on caching, you can email us here:
    feedback [at] wordfence.com

    Thread Starter christopherreay

    (@christopherreay)

    OK, so options are, either put a wordfence clear cache into wp-cron (e.g hourly)? Could you give example code for this?

    Or create a commentable post / page which is “scheduled Cache Clearing” and Cron a comment onto the page every hour.

    Would it not also be possible to embed php code: wfCache::scheduleCacheClear into a page template somewhere, and just open a page with that template? Seems like that function bypasses the admin checks.

    Plugin Author WFMattR

    (@wfmattr)

    The second option you mentioned about scheduling comments might be your best option, for now. wfCache::scheduleCacheClear is not a part of the publicly documented Wordfence API, so it could work currently, but may also change in the future. For example, if the developers later decide to add a required parameter to the function, your code might not work anymore.

    I will add this request to the list of new features for the developers to consider. I can’t promise that every suggestion we get will make it into a release, or when that might be, but every suggestion we get is evaluated carefully and considered seriously. We value the input we get from our customers. A member of our dev team may or may not reach out to you here to ask for more detail. Thank you for helping to make Wordfence great!

    We actually thought this over a while back but decided against it for some reason. I believe it had to do with not wanting the world to have access to clear your cache when you didn’t want it cleared.

    There is a workaround though. There are many actions that will clear your cache and it would be fairly easy* to create a script to call from a cron job.
    Here is an example:

    <?php
    include 'wp-load.php';
    wfCache::clearPageCache();
    ?>

    tim

    Tim,
    I would like to be able to clear the Falcon cache for multiple sites via InfiniteWP. IWP has a “Code Snippets” feature where I can push PHP to multiple sites. I was inspired by your code:

    <?php
    include ‘wp-load.php’;
    wfCache::clearPageCache();
    ?>

    When I execute it, I get this error: “Parse error: syntax error, unexpected ‘<‘ in /home/intersec/public_html/wp-content/plugins/iwp-client/init.php(1523) : eval()’d code on line 1”

    As I am not a PHP Guy, this could be a simple issue. Before reaching out to IWP for advice, I thought I’d check with you on whether this function you suggested a few months ago is still viable.

    Plugin Author WFMattR

    (@wfmattr)

    @bobimg: You may just need to exclude the <?php and ?> lines — it sounds like IWP is is already treating the pasted code as PHP, and wouldn’t need them like a .php file would.

    I’m not sure if the “include” line will work the same way within IWP’s code snippets — if it gives you errors about functions already being defined, try changing it to “include_once”.

    -Matt R

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Schedule Falcon Clear Cache with a Cron Job’ is closed to new replies.