Support » Plugin: Vendi Cache » Does it support Wordfence donotcache() function ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor cjhaas

    (@chrisvendiadvertisingcom)

    Hi wordpresslover7,

    In order for Vendi Cache to exist in an environment where Wordfence is also installed we had to rename anything that was Wordfence related for both technical and also legal reasons. We still have a little bit of code that has “Wordfence” in it (including a class with that name) but that will be going away soon.

    The very short and literal answer is that we cannot use that function exactly as is however we will be able to give you a different function that does the same exact thing. Currently there isn’t a function exposed but we’ve added that as a feature request and we should be able to push that out pretty soon.

    Until we push that change live, however, you can still use the built-in constants to tell us not to cache something. If at any point in your request pipeline you want to disable caching for a specific URL you can just set the global constant DONOTCACHEPAGE to true and we won’t cache anything:

    if( ! defined( 'DONOTCACHEPAGE' ) )
    {
        define( 'DONOTCACHEPAGE', true );
    }

    However, please note that setting this on something that was already previously cached will not un-cache it, you’ll need to manually do that and then we’ll begin to honor your command.

    Thanks,
    Chris

    Hey @chrisvendiadvertisingcom

    Has this function been introduced yet?

    I use it in my theme to tell wordfence/vendi cache not to cache pageviews counter. To be honest this is one of the main reasons I used wordfence cache followed by vendi cache.

    Fragment caching is a challange, wordfence::doNotCache() was a great solution while other caching plugins fail.

    Plugin Contributor cjhaas

    (@chrisvendiadvertisingcom)

    Hi wordpresslover7,

    We are planning on releasing an incremental update next week sometime (probably Tuesday or Wednesday) with this and a couple of other smaller but important features and tweaks.

    Thanks,
    Chris

    Superawesome ! Preapring for after-Christmas donation 🙂

    Plugin Contributor cjhaas

    (@chrisvendiadvertisingcom)

    Hi wordpresslover7, (Santa brought me a Windows 10 BSOD that I had to play with) but we just released version 1.2.0 that implements this feature.

    https://wordpress.org/plugins/vendi-cache/changelog/

    The preferred way to tell Vendi Cache to not cache a specific request is via a filter:

    add_filter( \Vendi\Cache\api::FILTER_NAME_DO_NOT_CACHE, '__return_true' );

    We prefer the filter because it is overridable which makes testing easier. If you want, however, we still have a static public method that you can invoke (that actually still calls the filter):

    \Vendi\Cache\api::do_not_cache()

    If you have any questions about this just let me know!

    Thanks,
    Chris

    Hi Chris !

    Finally I managed to test the new version.

    I added the api::do_not_cache() to the following request in my theme file. (I did it the same way in wordfence)

    <?php api::do_not_cache(); echo tie_views(); ?>

    This resulted in a fatal error. The request is to display non-cached views counter.

    Fatal error: Class 'api' not found in /example.com/wp-content/themes/sahifa/framework/parts/meta-archives.php on line 16

    How should I apply the filter correctly using your preffered approach or/and static method in my case?

    Plugin Contributor cjhaas

    (@chrisvendiadvertisingcom)

    Can you try using the fully-qualified class name?

    \Vendi\Cache\api::do_not_cache()

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Does it support Wordfence donotcache() function ?’ is closed to new replies.