• Resolved hassantafreshi

    (@hassantafreshi)


    Hello,
    While working on the?Easy Form Builder plugin, I encountered challenges with page caching. To resolve these issues, we use the following function to manage the interaction between Easy Form Builder and other page caching plugins.

    public function cache_cleaner_Efb($page_id,$plugins){
    $page_id = intval($page_id);
    $cache_plugins = json_decode($plugins);
    foreach($cache_plugins as $plugin){
    switch($plugin->slug){
    case 'litespeed-cache':
    if (defined('LSCWP_V') || defined('LSCWP_BASENAME' )) do_action( 'litespeed_purge_post', $page_id );
    break;
    case 'wp-rocket':
    if (function_exists('rocket_clean_post')) $r = rocket_clean_post($page_id);
    break;
    .
    .
    .

    }
    }

    }

    However, we’re seeking a more integrated solution. Specifically, we’re looking for a structure or method similar to what other plugins use to manage caching effectively.

    Thank you in advance for your help and insights!

    Best regards

    The page I need help with: [log in to see the link]

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

    (@docjojo)

    Not sure what your request is.
    Do you mean atec-cache-apcu ?
    We have a function atec_wpca_delete_page($suffix, $id) that can delete a page from cache.
    But we also check get_post_modified_time() of the post and refresh the page cache if it’s newer, so there is no need to flush a particular page.

    Thread Starter hassantafreshi

    (@hassantafreshi)

    Thank you for your response. Our main goal is to clear the page cache after the form submission, and I believe the get_post_modified_time() function might be suitable for this purpose. Could you please explain what parameters this function accepts and how we can properly call it within our plugin?

    Plugin Author docjojo

    (@docjojo)

    the function expects a suffix and the ID.
    the suffix is from a salt key and a prefix, like “p” for post.

    i think your approach will give you a lot of work, as you have to detect all page cache plugins and find out how they work.

    these page cache plugin should take care of the cache flush if required.

    Thread Starter hassantafreshi

    (@hassantafreshi)

    Based on our requirements, what do you suggest? Could you take a look at this function to ensure that both plugins can work smoothly together?

    Plugin Author docjojo

    (@docjojo)

    you can add.
    please test it with ate-cache-apcu enabled.
    the respective page should disappear from page cache list.

    case 'atec-cache-apcu':

    //atec-cache-apcu

    if (function_exists('atec_wpca_delete_page') && function_exists('atec_wpca_settings'))

    {

    if (atec_wpca_settings('cache'))

    {

    $suffix=($atec_wpca_settings['salt']??'').'_p';

    atec_wpca_delete_page($suffix,$page_id);

    }

    }

    break;
    Thread Starter hassantafreshi

    (@hassantafreshi)

    I have installed and activated ate-cache-apcu, and it seems that both plugins are working together without any issues. Thank you for your cooperation.


    Updated Code

    Plugin Author docjojo

    (@docjojo)

    great.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.