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
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
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.