public function WSConnectorSimpleHTTP::setCacheExpire in Web Service Data 8
Same name and namespace in other branches
- 2.0.x src/Plugin/WSConnector/WSConnectorSimpleHTTP.php \Drupal\wsdata\Plugin\WSConnector\WSConnectorSimpleHTTP::setCacheExpire()
Sets the expires times based on the response.
1 call to WSConnectorSimpleHTTP::setCacheExpire()
- WSConnectorSimpleHTTP::call in src/
Plugin/ WSConnector/ WSConnectorSimpleHTTP.php - Make the connector call.
File
- src/
Plugin/ WSConnector/ WSConnectorSimpleHTTP.php, line 291
Class
- WSConnectorSimpleHTTP
- HTTP Connector.
Namespace
Drupal\wsdata\Plugin\WSConnectorCode
public function setCacheExpire($response) {
$cache_header = $response
->getHeader('Cache-Control');
foreach ($cache_header as $control_header) {
if (preg_match("/^max-age=\\d+/", $control_header)) {
$this->expires = (int) str_replace('max-age=', '', $control_header);
}
}
return $this->expires;
}