Make WordPress Core


Ignore:
Timestamp:
07/23/2022 02:56:51 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Cache API: Make the placement of wp_cache_flush_group() more consistent.

Includes:

  • Placing WP_Object_Cache::flush_group() next to ::flush().
  • Placing wp_cache_supports_group_flush() next to wp_cache_flush_group().
  • Placing the wp_cache_flush_group() unit test next to the ::flush() method test.
  • Removing test name from assertion messages, as it is already mentioned directly above in case of failure.
  • Adjusting function descriptions per the documentation standards.

Follow-up to [52706], [53763].

See #55647, #4476.

File:
1 edited

Legend:

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

    r53763 r53767  
    2121function wp_cache_init() {
    2222    $GLOBALS['wp_object_cache'] = new WP_Object_Cache();
    23 }
    24 
    25 /**
    26  * Whether the object cache implementation supports flushing individual cache groups.
    27  *
    28  * @since 6.1.0
    29  *
    30  * @see WP_Object_Cache::flush_group()
    31  *
    32  * @return bool True if group flushing is supported, false otherwise.
    33  */
    34 function wp_cache_supports_group_flush() {
    35     return true;
    3623}
    3724
     
    297284/**
    298285 * Removes all cache items in a group, if the object cache implementation supports it.
    299  * Before calling this method, always check for group flushing support using the
    300  * `wp_cache_supports_group_flush()` method.
     286 *
     287 * Before calling this function, always check for group flushing support using the
     288 * `wp_cache_supports_group_flush()` function.
    301289 *
    302290 * @since 6.1.0
     
    312300
    313301    return $wp_object_cache->flush_group( $group );
     302}
     303
     304/**
     305 * Determines whether the object cache implementation supports flushing individual cache groups.
     306 *
     307 * @since 6.1.0
     308 *
     309 * @see WP_Object_Cache::flush_group()
     310 *
     311 * @return bool True if group flushing is supported, false otherwise.
     312 */
     313function wp_cache_supports_group_flush() {
     314    return true;
    314315}
    315316
Note: See TracChangeset for help on using the changeset viewer.