Skip to content

Commit 12a45c7

Browse files
committed
API consistency: return success/failure results of setting cache.
1 parent bd142f1 commit 12a45c7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/wp-includes/cache-compat.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,11 @@ function wp_cache_get_salted( $cache_key, $group, $salt ) {
239239
* @param string|string[] $salt The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
240240
* @param int $expire Optional. When to expire the cache contents, in seconds.
241241
* Default 0 (no expiration).
242+
* @return bool True on success, false on failure.
242243
*/
243244
function wp_cache_set_salted( $cache_key, $data, $group, $salt, $expire = 0 ) {
244245
$salt = is_array( $salt ) ? implode( ':', $salt ) : $salt;
245-
wp_cache_set(
246+
return wp_cache_set(
246247
$cache_key,
247248
array(
248249
'data' => $data,
@@ -296,6 +297,8 @@ function wp_cache_get_multiple_salted( $cache_keys, $group, $salt ) {
296297
* @param string|string[] $salt The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
297298
* @param int $expire Optional. When to expire the cache contents, in seconds.
298299
* Default 0 (no expiration).
300+
* @return bool[] Array of return values, grouped by key. Each value is either
301+
* true on success, or false on failure.
299302
*/
300303
function wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 ) {
301304
$salt = is_array( $salt ) ? implode( ':', $salt ) : $salt;
@@ -306,6 +309,6 @@ function wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 ) {
306309
'salt' => $salt,
307310
);
308311
}
309-
wp_cache_set_multiple( $new_cache, $group, $expire );
312+
return wp_cache_set_multiple( $new_cache, $group, $expire );
310313
}
311314
endif;

0 commit comments

Comments
 (0)