• Hello,

    I have an issue where the object cache and db cache garbage collection tasks do not run, while the page cache and minify cleanup tasks run without issues.

    The object cache and db cache are set to the Redis method, enabled, and working.

    I checked via the WP Crontrol plugin, and the “w3_objectcache_cleanup” and “w3_dbcache_cleanup” tasks are displayed as disabled. This is the same even with default or higher values for “Maximum lifetime of cache objects” and “Garbage collection interval”.

    How can I enable garbage collection for the object cache and db cache?

    https://snipboard.io/ERmcGM.jpg
    https://snipboard.io/hkMCL1.jpg
    https://snipboard.io/tRYiTI.jpg
    https://snipboard.io/ph6Nqg.jpg

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor ImageMarko Vasiljevic

    (@vmarko)

    Hello @proller

    Thank you for reaching out and I am happy to help!
    The Page Cache and Minify are set to cache to Disk. The garbage collection interval is used as it says in the description: If caching to disk, specify how frequently expired cache data is removed. For busy sites, a lower value is best.

    This being said, the GC interval is not running if the caching method is set to Redis or Memcached, and this is where the “Default lifetime of cache objects” comes into place as it etermines the natural expiration time of unchanged cache items. The higher the value, the larger the cache.

    I hope this helps!

    Thanks!

    Thread Starter Imageproller

    (@proller)

    Hello,

    Thank you for your reply.

    So, the garbage collection interval is not needed for the redis method.

    My issue is that some changes on the site like a theme update or updating page content cause broken styling for cached pages untill I manually flush the object cache and page cache. I assume that the page cache is renewed after those changes, while the object cache remains the same until its lifetime expires. So, the new page cache uses old data from the object cache. Since my page cache gc interval is 1 day, even if the object cache is cleared after the changes, it has to wait until the page cache gc task runs.

    Is this accurate? If so, instead of reducing the page cache gc interval, would hooking the object cache flush to the page cache flush solve this issue?


    add_action( 'w3tc_flush_posts', 'custom_flush_object_cache_on_page_flush' );
    function custom_flush_object_cache_on_page_flush() {
    if ( function_exists( 'w3tc_flush_group' ) ) {
    w3tc_flush_group( 'object' );
    }
    }
    • This reply was modified 2 weeks, 5 days ago by Imageproller.
    Plugin Contributor ImageMarko Vasiljevic

    (@vmarko)

    Hello @proller

    Can you please let me know if the issue persist if you only flush OC or Page Cache?

    Thanks!

    Thread Starter Imageproller

    (@proller)

    Hello,

    The issue is still there if I only flush either one of them.

    I reproduced the issue on a couple of sites when I update the elementor plugin. (Elementor’s caching is disabled. Prevent caching of objects after settings change in css & js section is enabled.) Sites which use the wpbakery plugin (where the rest of the plugins and theme are the same) do not have this issue, so I believe the issue is related to Elementor.

    When the issue occurs on a site where w3tc cdn (cloudfront) is enabled, the issue persists even after I flush all caches (whether at once or one by one). I had to disable and re-enable the cdn in order to get all pages working correctly.

    Plugin Contributor ImageMarko Vasiljevic

    (@vmarko)

    Hello @proller

    Thank you for your feedback.
    Just to confirm, this is related to Elementor, and are you using Regenerate CSS option

    Any chance you can try this solution?

    https://pastebin.com/raw/Z2NdizSE

    Thank you!

    Thread Starter Imageproller

    (@proller)

    Hello again,

    Using Elementor’s Clear Files & Data option makes no difference in my case.

    I applied the solution; however, it did not resolve the issue. The problem persists: flushing the page cache occasionally breaks the stylesheets on some pages.

    I also applied the modification to the Elementor update package and installed it as an update. Unfortunately, clearing the page cache for the first time after the update broke most of the pages’ stylesheets, just like before.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.