Title: WP_AI_Client_Cache::getMultiple
Published: May 20, 2026

---

# WP_AI_Client_Cache::getMultiple( iterable $keys, mixed $default_value = null ): array<string,

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#wp--skip-link--target)

Obtains multiple cache items by their unique keys.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#parameters)󠁿

 `$keys`<span class="iterable”>iterablerequired

A list of keys that can be obtained in a single operation.

`$default_value`mixedoptional

Default value to return for keys that do not exist.

Default:`null`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#return)󠁿

 array<string, mixed> A list of key => value pairs.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#source)󠁿

    ```php
    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, self::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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ai-client/adapters/class-wp-ai-client-cache.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ai-client/adapters/class-wp-ai-client-cache.php#L107)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ai-client/adapters/class-wp-ai-client-cache.php#L107-L127)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_AI_Client_Cache::iterable_to_array()](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/iterable_to_array/)`wp-includes/ai-client/adapters/class-wp-ai-client-cache.php` |

Converts an iterable to an array.

  | 
| [WP_AI_Client_Cache::get()](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/get/)`wp-includes/ai-client/adapters/class-wp-ai-client-cache.php` |

Fetches a value from the cache.

  | 
| [wp_cache_get_multiple()](https://developer.wordpress.org/reference/functions/wp_cache_get_multiple/)`wp-includes/cache.php` |

Retrieves multiple values from the cache in one call.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/getmultiple/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_ai_client_cache%2Fgetmultiple%2F)
before being able to contribute a note or feedback.