Make WordPress Core


Ignore:
Timestamp:
02/13/2024 08:52:23 AM (12 months ago)
Author:
spacedmonkey
Message:

Themes: Add 'theme_files' cache group to block pattern cache operations.

Use 'theme_files' cache group for block pattern caches. Previously, block pattern cache data was not stored in a cache group and used the default group. This new cache group, is setup as a global cache group, meaning that sites using multisite, will have a single cache for block pattern data per theme. This change also no longer invalidate block pattern caches in multisite instances, meaning block pattern caches can be shared between sites on a network, meaning less repeated data in the object cache.

Props spacedmonkey, flixos90, joemcgill.
Fixes #60120.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme.php

    r57584 r57608  
    19751975            return false;
    19761976        }
    1977         $pattern_data = wp_cache_get( 'wp_theme_patterns_' . $this->stylesheet );
     1977        $pattern_data = wp_cache_get( 'wp_theme_patterns_' . $this->stylesheet, 'theme_files' );
    19781978        if ( is_array( $pattern_data ) && $pattern_data['version'] === $this->get( 'Version' ) ) {
    19791979            return $pattern_data['patterns'];
     
    19941994            'patterns' => $patterns,
    19951995        );
    1996         wp_cache_set( 'wp_theme_patterns_' . $this->stylesheet, $pattern_data );
     1996        wp_cache_set( 'wp_theme_patterns_' . $this->stylesheet, $pattern_data, 'theme_files' );
    19971997    }
    19981998
     
    20032003     */
    20042004    public function delete_pattern_cache() {
    2005         wp_cache_delete( 'wp_theme_patterns_' . $this->stylesheet );
     2005        wp_cache_delete( 'wp_theme_patterns_' . $this->stylesheet, 'theme_files' );
    20062006    }
    20072007
Note: See TracChangeset for help on using the changeset viewer.