wp/wp-includes/cache-compat.php
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 21 48c4eec2b7e6
permissions -rw-r--r--
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Object Cache API functions missing from 3rd party object caches.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
     5
 * @link https://developer.wordpress.org/reference/classes/wp_object_cache/
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @package WordPress
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * @subpackage Cache
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 */
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    11
if ( ! function_exists( 'wp_cache_add_multiple' ) ) :
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    12
	/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    13
	 * Adds multiple values to the cache in one call, if the cache keys don't already exist.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    14
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    15
	 * Compat function to mimic wp_cache_add_multiple().
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    16
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    17
	 * @ignore
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    18
	 * @since 6.0.0
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    19
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    20
	 * @see wp_cache_add_multiple()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    21
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    22
	 * @param array  $data   Array of keys and values to be added.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    23
	 * @param string $group  Optional. Where the cache contents are grouped. Default empty.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    24
	 * @param int    $expire Optional. When to expire the cache contents, in seconds.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    25
	 *                       Default 0 (no expiration).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    26
	 * @return bool[] Array of return values, grouped by key. Each value is either
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    27
	 *                true on success, or false if cache key and group already exist.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    28
	 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    29
	function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    30
		$values = array();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    31
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    32
		foreach ( $data as $key => $value ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    33
			$values[ $key ] = wp_cache_add( $key, $value, $group, $expire );
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    34
		}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    35
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    36
		return $values;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    37
	}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    38
endif;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    39
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    40
if ( ! function_exists( 'wp_cache_set_multiple' ) ) :
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    41
	/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    42
	 * Sets multiple values to the cache in one call.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    43
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    44
	 * Differs from wp_cache_add_multiple() in that it will always write data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    45
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    46
	 * Compat function to mimic wp_cache_set_multiple().
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    47
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    48
	 * @ignore
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    49
	 * @since 6.0.0
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    50
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    51
	 * @see wp_cache_set_multiple()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    52
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    53
	 * @param array  $data   Array of keys and values to be set.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    54
	 * @param string $group  Optional. Where the cache contents are grouped. Default empty.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    55
	 * @param int    $expire Optional. When to expire the cache contents, in seconds.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    56
	 *                       Default 0 (no expiration).
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    57
	 * @return bool[] Array of return values, grouped by key. Each value is either
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    58
	 *                true on success, or false on failure.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    59
	 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    60
	function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    61
		$values = array();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    62
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    63
		foreach ( $data as $key => $value ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    64
			$values[ $key ] = wp_cache_set( $key, $value, $group, $expire );
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    65
		}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    66
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    67
		return $values;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    68
	}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    69
endif;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    70
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
if ( ! function_exists( 'wp_cache_get_multiple' ) ) :
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
	/**
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
	 * Retrieves multiple values from the cache in one call.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
	 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
	 * Compat function to mimic wp_cache_get_multiple().
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
	 * @ignore
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
	 * @since 5.5.0
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
	 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	 * @see wp_cache_get_multiple()
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
	 *
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	 * @param array  $keys  Array of keys under which the cache contents are stored.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
	 * @param string $group Optional. Where the cache contents are grouped. Default empty.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	 * @param bool   $force Optional. Whether to force an update of the local cache
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
	 *                      from the persistent cache. Default false.
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    86
	 * @return array Array of return values, grouped by key. Each value is either
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    87
	 *               the cache contents on success, or false on failure.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
	 */
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
	function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
		$values = array();
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
		foreach ( $keys as $key ) {
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
			$values[ $key ] = wp_cache_get( $key, $group, $force );
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
		}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
		return $values;
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
	}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
endif;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    99
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   100
if ( ! function_exists( 'wp_cache_delete_multiple' ) ) :
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   101
	/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   102
	 * Deletes multiple values from the cache in one call.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   103
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   104
	 * Compat function to mimic wp_cache_delete_multiple().
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   105
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   106
	 * @ignore
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   107
	 * @since 6.0.0
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   108
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   109
	 * @see wp_cache_delete_multiple()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   110
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   111
	 * @param array  $keys  Array of keys under which the cache to deleted.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   112
	 * @param string $group Optional. Where the cache contents are grouped. Default empty.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   113
	 * @return bool[] Array of return values, grouped by key. Each value is either
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   114
	 *                true on success, or false if the contents were not deleted.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   115
	 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   116
	function wp_cache_delete_multiple( array $keys, $group = '' ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   117
		$values = array();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   118
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   119
		foreach ( $keys as $key ) {
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   120
			$values[ $key ] = wp_cache_delete( $key, $group );
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   121
		}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   122
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   123
		return $values;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   124
	}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   125
endif;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   126
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   127
if ( ! function_exists( 'wp_cache_flush_runtime' ) ) :
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   128
	/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   129
	 * Removes all cache items from the in-memory runtime cache.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   130
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   131
	 * Compat function to mimic wp_cache_flush_runtime().
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   132
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   133
	 * @ignore
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   134
	 * @since 6.0.0
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   135
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   136
	 * @see wp_cache_flush_runtime()
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   137
	 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   138
	 * @return bool True on success, false on failure.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   139
	 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   140
	function wp_cache_flush_runtime() {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   141
		if ( ! wp_cache_supports( 'flush_runtime' ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   142
			_doing_it_wrong(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   143
				__FUNCTION__,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   144
				__( 'Your object cache implementation does not support flushing the in-memory runtime cache.' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   145
				'6.1.0'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   146
			);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   147
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   148
			return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   149
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   150
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   151
		return wp_cache_flush();
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   152
	}
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   153
endif;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   154
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   155
if ( ! function_exists( 'wp_cache_flush_group' ) ) :
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   156
	/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   157
	 * Removes all cache items in a group, if the object cache implementation supports it.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   158
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   159
	 * Before calling this function, always check for group flushing support using the
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   160
	 * `wp_cache_supports( 'flush_group' )` function.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   161
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   162
	 * @since 6.1.0
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   163
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   164
	 * @see WP_Object_Cache::flush_group()
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   165
	 * @global WP_Object_Cache $wp_object_cache Object cache global instance.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   166
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   167
	 * @param string $group Name of group to remove from cache.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   168
	 * @return bool True if group was flushed, false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   169
	 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   170
	function wp_cache_flush_group( $group ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   171
		global $wp_object_cache;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   172
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   173
		if ( ! wp_cache_supports( 'flush_group' ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   174
			_doing_it_wrong(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   175
				__FUNCTION__,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   176
				__( 'Your object cache implementation does not support flushing individual groups.' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   177
				'6.1.0'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   178
			);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   179
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   180
			return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   181
		}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   182
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   183
		return $wp_object_cache->flush_group( $group );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   184
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   185
endif;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   186
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   187
if ( ! function_exists( 'wp_cache_supports' ) ) :
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   188
	/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   189
	 * Determines whether the object cache implementation supports a particular feature.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   190
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   191
	 * @since 6.1.0
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   192
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   193
	 * @param string $feature Name of the feature to check for. Possible values include:
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   194
	 *                        'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple',
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   195
	 *                        'flush_runtime', 'flush_group'.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   196
	 * @return bool True if the feature is supported, false otherwise.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   197
	 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   198
	function wp_cache_supports( $feature ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   199
		return false;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   200
	}
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   201
endif;