protected function TwitterWidgetSubscriber::setExpiresCacheLifetime in Twitter Profile Widget 8.2
Same name and namespace in other branches
- 8 src/EventSubscriber/TwitterWidgetSubscriber.php \Drupal\twitter_profile_widget\EventSubscriber\TwitterWidgetSubscriber::setExpiresCacheLifetime()
- 3.x src/EventSubscriber/TwitterWidgetSubscriber.php \Drupal\twitter_profile_widget\EventSubscriber\TwitterWidgetSubscriber::setExpiresCacheLifetime()
Set cache lifetime to cache.page.max_age.
This overrides the default logic provided by Internal Page Cache.
Parameters
\Symfony\Component\HttpFoundation\Response $response: A response object.
1 call to TwitterWidgetSubscriber::setExpiresCacheLifetime()
- TwitterWidgetSubscriber::onRespond in src/
EventSubscriber/ TwitterWidgetSubscriber.php - Sets extra headers on successful responses.
File
- src/
EventSubscriber/ TwitterWidgetSubscriber.php, line 126
Class
- TwitterWidgetSubscriber
- Class TwitterWidgetSubscriber.
Namespace
Drupal\twitter_profile_widget\EventSubscriberCode
protected function setExpiresCacheLifetime(Response $response) {
$max_age = \Drupal::config('twitter_profile_widget.settings')
->get('twitter_widget_cache_time');
$response
->setExpires(\DateTime::createFromFormat('U', time() + $max_age));
}