Making WordPress.org


Ignore:
Timestamp:
03/31/2020 04:06:55 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Clear memcache/db in-memory caches during XML Sitemap generation.

Fixes #5025.

File:
1 edited

Legend:

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

    r9008 r9650  
    538538        return $users;
    539539    }
     540
     541    /**
     542     * Clear caches for memory management.
     543     *
     544     * @static
     545     * @global \wpdb            $wpdb
     546     * @global \WP_Object_Cache $wp_object_cache
     547     */
     548    public static function clear_memory_heavy_variables() {
     549        global $wpdb, $wp_object_cache;
     550
     551        $wpdb->queries = [];
     552
     553        if ( is_object( $wp_object_cache ) ) {
     554            $wp_object_cache->cache          = [];
     555            $wp_object_cache->group_ops      = [];
     556            $wp_object_cache->memcache_debug = [];
     557        }
     558    }
    540559}
Note: See TracChangeset for help on using the changeset viewer.