WP_AI_Client_Cache::set
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
Method of the class: WP_AI_Client_Cache{}
No Hooks.
Returns
true|false. True on success and false on failure.
Usage
$WP_AI_Client_Cache = new WP_AI_Client_Cache(); $WP_AI_Client_Cache->set( $key, $value, $ttl ): bool;
- $key(string) (required)
- The key of the item to store.
- $value(mixed) (required)
- The value of the item to store, must be serializable.
- $ttl(null|int|DateInterval)
- The TTL value of this item.
Default:null
Changelog
| Since 7.0.0 | Introduced. |
WP_AI_Client_Cache::set() WP AI Client Cache::set code WP 7.0
public function set( $key, $value, $ttl = null ): bool {
$expire = $this->ttl_to_seconds( $ttl );
return wp_cache_set( $key, $value, self::CACHE_GROUP, $expire );
}