WP_AI_Client_Cache::get( string $key, mixed $default_value = null ): mixed

In this article

Fetches a value from the cache.

Parameters

$keystringrequired
The unique key of this item in the cache.
$default_valuemixedoptional
Default value to return if the key does not exist.

Default:null

Return

mixed The value of the item from the cache, or $default_value in case of cache miss.

Source

public function get( $key, $default_value = null ) {
	$found = false;
	$value = wp_cache_get( $key, self::CACHE_GROUP, false, $found );

	if ( ! $found ) {
		return $default_value;
	}

	return $value;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.