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

---

# WP_AI_Client_Cache::has( string $key ): bool

## In this article

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

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

Determines whether an item is present in the cache.

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

 `$key`stringrequired

The cache item key.

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

 bool True if the item exists in the cache, false otherwise.

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

    ```php
    public function has( $key ): bool {
    	$found = false;
    	wp_cache_get( $key, self::CACHE_GROUP, false, $found );

    	return (bool) $found;
    }
    ```

[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#L171)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ai-client/adapters/class-wp-ai-client-cache.php#L171-L176)

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

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

Retrieves the cache contents from the cache by key and group.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_cache/has/?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%2Fhas%2F)
before being able to contribute a note or feedback.