WP_AI_Client_Cache::getMultiple
Obtains multiple cache items by their unique keys.
Метод класса: WP_AI_Client_Cache{}
Хуков нет.
Возвращает
array<string, mixed>. A list of key => value pairs.
Использование
$WP_AI_Client_Cache = new WP_AI_Client_Cache(); $WP_AI_Client_Cache->getMultiple( $keys, $default_value ): array;
- $keys(iterable
) (обязательный) - A list of keys that can be obtained in a single operation.
- $default_value(разное)
- Default value to return for keys that do not exist.
По умолчанию:null
Список изменений
| С версии 7.0.0 | Введена. |
Код WP_AI_Client_Cache::getMultiple() WP AI Client Cache::getMultiple WP 7.1.2
public function getMultiple( $keys, $default_value = null ): array {
/**
* Keys array.
*
* @var array<string> $keys_array
*/
$keys_array = $this->iterable_to_array( $keys );
$values = wp_cache_get_multiple( $keys_array, $this->get_cache_group() );
$result = array();
foreach ( $keys_array as $key ) {
if ( false === $values[ $key ] ) {
// Could be a stored false or a cache miss — disambiguate via get().
$result[ $key ] = $this->get( $key, $default_value );
} else {
$result[ $key ] = $values[ $key ];
}
}
return $result;
}