wp_cache_set_multiple_salted()
Stores multiple pieces of salted data in the cache.
Хуков нет.
Возвращает
true|false[]. Array of return values, grouped by key. Each value is either true on success, or false on failure.
Использование
wp_cache_set_multiple_salted( $data, $group, $salt, $expire );
- $data(разное) (обязательный)
- Data to be stored in the cache for all keys.
- $group(строка) (обязательный)
- Group to which the cached data belongs.
- $salt(строка|string[]) (обязательный)
- The timestamp (or multiple timestamps if an array) indicating when the cache group(s) were last updated.
- $expire(int)
- When to expire the cache contents, in seconds.
По умолчанию: 0 (no expiration)
Список изменений
| С версии 6.9.0 | Введена. |
Код wp_cache_set_multiple_salted() wp cache set multiple salted WP 6.9
function wp_cache_set_multiple_salted( $data, $group, $salt, $expire = 0 ) {
$salt = is_array( $salt ) ? implode( ':', $salt ) : $salt;
$new_cache = array();
foreach ( $data as $key => $value ) {
$new_cache[ $key ] = array(
'data' => $value,
'salt' => $salt,
);
}
return wp_cache_set_multiple( $new_cache, $group, $expire );
}