Forums Forums Search & Filter Pro Rebuild Cache in background and swap it after it has been created

  • This topic has 28 replies, 3 voices, and was last updated 4 years ago by Ross.
Viewing 10 posts - 1 through 10 (of 29 total)
  • Anonymous
    #235964

    Hi,

    we append products to our quite big catalog via adding them with WP AllImport, e.g. we have 5000 products and ad 500.
    It seems that this means we need to manually refresh the S&F Cache then which takes more than an hour now.
    During this time our customers can only find the newly, up to that moment, cached files although many of the files did not change.
    Or am I wrong and the cache will be updated automatically and I just didn’t wait long enough?
    If we have to update manually:
    Is there a possibility to refresh the cache “in the background” i.e. keep the old cache and once the refreshed one is finished the new one replaces the old one?

    Thanks,

    Paul

    Trevor
    #235993

    You should be able to use a filter in WP All Import to do this.

    Add something like this in the child theme functions.php file:

    add_action('pmxi_saved_post', 'wp_all_import_post_saved', 1000, 1);
    
    function wp_all_import_post_saved($id) {
        do_action('search_filter_update_post_cache', $id);
    }

    Do a test import of a post and see if it has been added to the cache.

    Anonymous
    #236217
    This reply has been marked as private.
    Trevor
    #236219

    The code updates the cache/index only for the added/changed products, not the whole cache. It does it one product at a time, which is the way the importer works (it doesn’t bulk import all products in one database write, it does it one at a time).

    Anonymous
    #236221

    Sounds great!
    Thanks Trevor!

    Trevor
    #236223

    I will leave this open for you to try, if you could get back to me to confirm if it works?

    No need to reply now though, unless you have already tested it.

    Anonymous
    #239469
    This reply has been marked as private.
    Trevor
    #239473

    Did you use an import plugin? If so, was it WP All Import? Otherwise, I am impressed with your typing speed 😉

    Anonymous
    #239491
    This reply has been marked as private.
    Trevor
    #239499

    This post might therefore be relevant:

    https://support.searchandfilter.com/forums/topic/cache-building/#post-238754

    For now, you will need to trigger a manual cache build from the form design/edit page in admin. The button is on the top right of the edit page.

Viewing 10 posts - 1 through 10 (of 29 total)