WP_AI_Client_Cache::getpublicWP 7.0.0

Fetches a value from the cache.

Method of the class: WP_AI_Client_Cache{}

No Hooks.

Returns

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

Usage

$WP_AI_Client_Cache = new WP_AI_Client_Cache();
$WP_AI_Client_Cache->get( $key, $default_value );
$key(string) (required)
The unique key of this item in the cache.
$default_value(mixed)
Default value to return if the key does not exist.
Default: null

Changelog

Since 7.0.0 Introduced.

WP_AI_Client_Cache::get() code WP 7.0

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;
}