Changeset 52700 for trunk/src/wp-includes/cache-compat.php
- Timestamp:
- 02/11/2022 12:50:54 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cache-compat.php
r47944 r52700 36 36 } 37 37 endif; 38 39 if ( ! function_exists( 'wp_cache_delete_multiple' ) ) : 40 /** 41 * Delete multiple values from the cache in one call. 42 * 43 * Compat function to mimic wp_cache_delete_multiple(). 44 * 45 * @ignore 46 * @since 6.0.0 47 * 48 * @see wp_cache_delete_multiple() 49 * 50 * @param array $keys Array of keys under which the cache to deleted. 51 * @param string $group Optional. Where the cache contents are grouped. Default empty. 52 * @return array Array of return values. 53 */ 54 function wp_cache_delete_multiple( array $keys, $group = '' ) { 55 $values = array(); 56 57 foreach ( $keys as $key ) { 58 $values[ $key ] = wp_cache_delete( $key, $group ); 59 } 60 61 return $values; 62 } 63 endif; 64 65 66 if ( ! function_exists( 'wp_cache_add_multiple' ) ) : 67 /** 68 * Add multiple values to the cache in one call, if the cache keys doesn't already exist. 69 * 70 * Compat function to mimic wp_cache_add_multiple(). 71 * 72 * @ignore 73 * @since 6.0.0 74 * 75 * @see wp_cache_add_multiple() 76 * 77 * @param array $data Array of key and value to be added. 78 * @param string $group Optional. Where the cache contents are grouped. Default empty. 79 * @param int $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration). 80 * @return array Array of return values. 81 */ 82 function wp_cache_add_multiple( array $data, $group = '', $expire = 0 ) { 83 $values = array(); 84 85 foreach ( $data as $key => $value ) { 86 $values[ $key ] = wp_cache_add( $key, $value, $group, $expire ); 87 } 88 89 return $values; 90 } 91 endif; 92 93 if ( ! function_exists( 'wp_cache_set_multiple' ) ) : 94 /** 95 * Set multiple values to the cache in one call. 96 * 97 * Differs from wp_cache_add_multiple() in that it will always write data. 98 * 99 * Compat function to mimic wp_cache_set_multiple(). 100 * 101 * @ignore 102 * @since 6.0.0 103 * 104 * @see wp_cache_set_multiple() 105 * 106 * @param array $data Array of key and value to be set. 107 * @param string $group Optional. Where the cache contents are grouped. Default empty. 108 * @param int $expire Optional. When to expire the cache contents, in seconds. Default 0 (no expiration). 109 * @return array Array of return values. 110 */ 111 function wp_cache_set_multiple( array $data, $group = '', $expire = 0 ) { 112 $values = array(); 113 114 foreach ( $data as $key => $value ) { 115 $values[ $key ] = wp_cache_set( $key, $value, $group, $expire ); 116 } 117 118 return $values; 119 } 120 endif;
Note: See TracChangeset
for help on using the changeset viewer.