Make WordPress Core


Ignore:
Timestamp:
03/10/2023 04:27:23 PM (4 years ago)
Author:
spacedmonkey
Message:

Cache API: Introduce new queries cache groups.

Give developers more control over how query caches are handled within an object caches. Now all caches that cache the result of a query, are cached in a group that is suffixed with -queries. Developers can use these groups, to add custom cache invalidation rules or to make them none persistent.

Props spacedmonkey, owi, tillkruess, skithund, peterwilsoncc, flixos90, sergeybiryukov, mukesh27.
Fixes #57625.

File:
1 edited

Legend:

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

    r54637 r55526  
    359359
    360360                $cache_key   = "get_sites:$key:$last_changed";
    361                 $cache_value = wp_cache_get( $cache_key, 'sites' );
     361                $cache_value = wp_cache_get( $cache_key, 'site-queries' );
    362362
    363363                if ( false === $cache_value ) {
    … …  
    371371                                'found_sites' => $this->found_sites,
    372372                        );
    373                         wp_cache_add( $cache_key, $cache_value, 'sites' );
     373                        wp_cache_add( $cache_key, $cache_value, 'site-queries' );
    374374                } else {
    375375                        $site_ids          = $cache_value['site_ids'];
Note: See TracChangeset for help on using the changeset viewer.