wp_cache_init example

if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
        wp_cache_switch_to_blog( $new_blog_id );
    } else {
        global $wp_object_cache;

        if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) {
            $global_groups = $wp_object_cache->global_groups;
        } else {
            $global_groups = false;
        }

        wp_cache_init();

        if ( function_exists( 'wp_cache_add_global_groups' ) ) {
            if ( is_array( $global_groups ) ) {
                wp_cache_add_global_groups( $global_groups );
            } else {
                wp_cache_add_global_groups(
                    array(
                        'blog-details',
                        'blog-id-cache',
                        'blog-lookup',
                        'blog_meta',
                        
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',
                
Home | Imprint | This part of the site doesn't use cookies.