wp_start_object_cache

The timeline below displays how wordpress function wp_start_object_cache has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Starts the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * runtimes. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                  Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'network-queries', 'sites', 'site-details', 'site-options', 'site-queries', 'site-transient', 'theme_files', 'translation_files', 'rss', 'users', 'user-queries', 'user_meta', 'useremail', 'userlogins', 'userslugs'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins', 'theme_json'));
    }
    $first_init = false;
}

WordPress Version: 6.3

/**
 * Starts the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * runtimes. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                  Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'network-queries', 'sites', 'site-details', 'site-options', 'site-queries', 'site-transient', 'rss', 'users', 'user-queries', 'user_meta', 'useremail', 'userlogins', 'userslugs'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins', 'theme_json'));
    }
    $first_init = false;
}

WordPress Version: 6.2

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * runtimes. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                  Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'sites', 'site-details', 'site-options', 'site-transient', 'rss', 'users', 'useremail', 'userlogins', 'usermeta', 'user_meta', 'userslugs'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins', 'theme_json'));
    }
    $first_init = false;
}

WordPress Version: 6.1

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * runtimes. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                  Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'sites', 'site-details', 'site-options', 'site-transient', 'rss', 'users', 'useremail', 'userlogins', 'usermeta', 'user_meta', 'userslugs'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 5.9

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * runtimes. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                  Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 5.8

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    /**
     * Filters whether to enable loading of the object-cache.php drop-in.
     *
     * This filter runs before it can be used by plugins. It is designed for non-web
     * run-times. If false is returned, object-cache.php will never be loaded.
     *
     * @since 5.8.0
     *
     * @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
     *                                    Default true.
     */
    if ($first_init && apply_filters('enable_loading_object_cache_dropin', true)) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 5.5

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    if ($first_init) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    require_once ABSPATH . WPINC . '/cache-compat.php';
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 5.4

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    if ($first_init) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php.
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 5.1

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    static $first_init = true;
    // Only perform the following checks once.
    if ($first_init) {
        if (!function_exists('wp_cache_init')) {
            /*
             * This is the normal situation. First-run of this function. No
             * caching backend has been loaded.
             *
             * We try to load a custom caching backend, and then, if it
             * results in a wp_cache_init() function existing, we note
             * that an external object cache is being used.
             */
            if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
                require_once WP_CONTENT_DIR . '/object-cache.php';
                if (function_exists('wp_cache_init')) {
                    wp_using_ext_object_cache(true);
                }
                // Re-initialize any hooks added manually by object-cache.php
                if ($wp_filter) {
                    $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
                }
            }
        } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            /*
             * Sometimes advanced-cache.php can load object-cache.php before
             * this function is run. This breaks the function_exists() check
             * above and can result in wp_using_ext_object_cache() returning
             * false when actually an external cache is in use.
             */
            wp_using_ext_object_cache(true);
        }
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites', 'blog_meta'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
    $first_init = false;
}

WordPress Version: 4.9

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global array $wp_filter Stores all of the filters.
 */
function wp_start_object_cache()
{
    global $wp_filter;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
            // Re-initialize any hooks added manually by object-cache.php
            if ($wp_filter) {
                $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
}

WordPress Version: 4.8

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 */
function wp_start_object_cache()
{
    global $wp_filter;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
            // Re-initialize any hooks added manually by object-cache.php
            if ($wp_filter) {
                $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
}

WordPress Version: 7.1

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 */
function wp_start_object_cache()
{
    global $wp_filter;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
            // Re-initialize any hooks added manually by object-cache.php
            if ($wp_filter) {
                $wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
}

WordPress Version: 4.7

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 */
function wp_start_object_cache()
{
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog(get_current_blog_id());
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
}

WordPress Version: 4.6

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('counts', 'plugins'));
    }
}

WordPress Version: 4.5

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}

WordPress Version: .10

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}

WordPress Version: 4.2

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } elseif (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}

WordPress Version: 4.0

/**
 * Start the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @since 3.0.0
 * @access private
 *
 * @global int $blog_id Blog ID.
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } else if (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        /*
         * Sometimes advanced-cache.php can load object-cache.php before
         * it is loaded here. This breaks the function_exists check above
         * and can result in `$_wp_using_ext_object_cache` being set
         * incorrectly. Double check if an external cache exists.
         */
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    /*
     * If cache supports reset, reset instead of init if already
     * initialized. Reset signals to the cache that global IDs
     * have changed and it may need to update keys and cleanup caches.
     */
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}

WordPress Version: 3.7

/**
 * Starts the WordPress object cache.
 *
 * If an object-cache.php file exists in the wp-content directory,
 * it uses that drop-in as an external object cache.
 *
 * @access private
 * @since 3.0.0
 */
function wp_start_object_cache()
{
    global $blog_id;
    $first_init = false;
    if (!function_exists('wp_cache_init')) {
        if (file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
            require_once WP_CONTENT_DIR . '/object-cache.php';
            if (function_exists('wp_cache_init')) {
                wp_using_ext_object_cache(true);
            }
        }
        $first_init = true;
    } else if (!wp_using_ext_object_cache() && file_exists(WP_CONTENT_DIR . '/object-cache.php')) {
        // Sometimes advanced-cache.php can load object-cache.php before it is loaded here.
        // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache
        // being set incorrectly. Double check if an external cache exists.
        wp_using_ext_object_cache(true);
    }
    if (!wp_using_ext_object_cache()) {
        require_once ABSPATH . WPINC . '/cache.php';
    }
    // If cache supports reset, reset instead of init if already initialized.
    // Reset signals to the cache that global IDs have changed and it may need to update keys
    // and cleanup caches.
    if (!$first_init && function_exists('wp_cache_switch_to_blog')) {
        wp_cache_switch_to_blog($blog_id);
    } elseif (function_exists('wp_cache_init')) {
        wp_cache_init();
    }
    if (function_exists('wp_cache_add_global_groups')) {
        wp_cache_add_global_groups(array('users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache'));
        wp_cache_add_non_persistent_groups(array('comment', 'counts', 'plugins'));
    }
}