Making WordPress.org


Ignore:
Timestamp:
11/20/2019 06:59:20 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Cron Jobs: Clear the Memcache cache within WordPress after processing lots of posts to allow Jetpack Sync to have some memory free.

This avoids plenty of post-shutdown fatals in cron tasks WordPress.org is currently experiencing and consolidates such code to a single instance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php

    r8975 r9284  
    310310    }
    311311
     312    /**
     313     * Clear caches for memory management.
     314     *
     315     * @static
     316     * @global \wpdb            $wpdb
     317     * @global \WP_Object_Cache $wp_object_cache
     318     */
     319    public static function clear_memory_heavy_variables() {
     320        global $wpdb, $wp_object_cache;
     321
     322        $wpdb->queries = [];
     323
     324        if ( is_object( $wp_object_cache ) ) {
     325            $wp_object_cache->cache          = [];
     326            $wp_object_cache->group_ops      = [];
     327            $wp_object_cache->memcache_debug = [];
     328        }
     329    }
    312330
    313331}
Note: See TracChangeset for help on using the changeset viewer.