WP_AI_Client_Cache::set( string $key, mixed $value, null|int|DateInterval $ttl = null ): bool

In this article

Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.

Parameters

$keystringrequired
The key of the item to store.
$valuemixedrequired
The value of the item to store, must be serializable.
$ttlnull|int|DateIntervaloptional
The TTL value of this item.

Default:null

Return

bool True on success and false on failure.

Source

public function set( $key, $value, $ttl = null ): bool {
	$expire = $this->ttl_to_seconds( $ttl );

	return wp_cache_set( $key, $value, self::CACHE_GROUP, $expire );
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

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