Changeset 54448
- Timestamp:
- 10/10/2022 06:20:28 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cache-compat.php
r53767 r54448 139 139 */ 140 140 function wp_cache_flush_runtime() { 141 return wp_using_ext_object_cache() ? false : wp_cache_flush(); 141 if ( ! wp_cache_supports( 'flush_runtime' ) ) { 142 _doing_it_wrong( 143 __FUNCTION__, 144 __( 'Your object cache implementation does not support flushing the in-memory runtime cache.' ), 145 '6.1.0' 146 ); 147 148 return false; 149 } 150 151 return wp_cache_flush(); 142 152 } 143 153 endif; … … 148 158 * 149 159 * Before calling this function, always check for group flushing support using the 150 * `wp_cache_supports _group_flush()` function.160 * `wp_cache_supports( 'flush_group' )` function. 151 161 * 152 162 * @since 6.1.0 … … 161 171 global $wp_object_cache; 162 172 163 if ( ! wp_cache_supports _group_flush() ) {173 if ( ! wp_cache_supports( 'flush_group' ) ) { 164 174 _doing_it_wrong( 165 175 __FUNCTION__, … … 175 185 endif; 176 186 177 if ( ! function_exists( 'wp_cache_supports _group_flush' ) ) :178 /** 179 * Determines whether the object cache implementation supports flushing individual cache groups.187 if ( ! function_exists( 'wp_cache_supports' ) ) : 188 /** 189 * Determines whether the object cache implementation supports a particular feature. 180 190 * 181 191 * @since 6.1.0 182 192 * 183 * @see WP_Object_Cache::flush_group() 184 * 185 * @return bool True if group flushing is supported, false otherwise. 186 */ 187 function wp_cache_supports_group_flush() { 193 * @param string $feature Name of the feature to check for. Possible values include: 194 * 'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple', 195 * 'flush_runtime', 'flush_group'. 196 * @return bool True if the feature is supported, false otherwise. 197 */ 198 function wp_cache_supports( $feature ) { 188 199 return false; 189 200 } -
trunk/src/wp-includes/cache.php
r53767 r54448 286 286 * 287 287 * Before calling this function, always check for group flushing support using the 288 * `wp_cache_supports _group_flush()` function.288 * `wp_cache_supports( 'flush_group' )` function. 289 289 * 290 290 * @since 6.1.0 … … 303 303 304 304 /** 305 * Determines whether the object cache implementation supports flushing individual cache groups.305 * Determines whether the object cache implementation supports a particular feature. 306 306 * 307 307 * @since 6.1.0 308 308 * 309 * @see WP_Object_Cache::flush_group() 310 * 311 * @return bool True if group flushing is supported, false otherwise. 312 */ 313 function wp_cache_supports_group_flush() { 314 return true; 309 * @param string $feature Name of the feature to check for. Possible values include: 310 * 'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple', 311 * 'flush_runtime', 'flush_group'. 312 * @return bool True if the feature is supported, false otherwise. 313 */ 314 function wp_cache_supports( $feature ) { 315 switch ( $feature ) { 316 case 'add_multiple': 317 case 'set_multiple': 318 case 'get_multiple': 319 case 'delete_multiple': 320 case 'flush_runtime': 321 case 'flush_group': 322 return true; 323 324 default: 325 return false; 326 } 315 327 } 316 328 -
trunk/tests/phpunit/includes/object-cache.php
r54423 r54448 314 314 315 315 /** 316 * Whether the object cache implementation supports flushing individual cache groups.316 * Determines whether the object cache implementation supports a particular feature. 317 317 * 318 318 * @since 6.1.0 319 319 * 320 * @return bool True if group flushing is supported, false otherwise. 321 */ 322 function wp_cache_supports_group_flush() { 320 * @param string $feature Name of the feature to check for. Possible values include: 321 * 'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple', 322 * 'flush_runtime', 'flush_group'. 323 * @return bool True if the feature is supported, false otherwise. 324 */ 325 function wp_cache_supports( $feature ) { 323 326 return false; 324 327 } -
trunk/tests/phpunit/tests/pluggable.php
r54240 r54448 327 327 'wp_cache_flush_runtime' => array(), 328 328 'wp_cache_flush_group' => array( 'group' ), 329 'wp_cache_supports _group_flush' => array(),329 'wp_cache_supports' => array( 'feature' ), 330 330 'wp_cache_close' => array(), 331 331 'wp_cache_add_global_groups' => array( 'groups' ),
Note: See TracChangeset
for help on using the changeset viewer.