Caches an array of events data from the Events API.
Parameters
$events
arrayrequired- Response body from the API request.
$expiration
int|falseoptional- Amount of time to cache the events. Defaults to false.
Default:
false
Source
protected function cache_events( $events, $expiration = false ) {
$set = false;
$transient_key = $this->get_events_transient_key( $events['location'] );
$cache_expiration = $expiration ? absint( $expiration ) : HOUR_IN_SECONDS * 12;
if ( $transient_key ) {
$set = set_site_transient( $transient_key, $events, $cache_expiration );
}
return $set;
}
Changelog
Version | Description |
---|---|
4.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.