class ExcludePages in Advanced Page Expiration 8
Cache policy that denies caching if the page matches a list of exclusions.
This is in the response policy rather than request policy because a request stack needs to be in place for the RequestPath plugin.
Hierarchy
- class \Drupal\ape\PageCache\ExcludePages implements ResponsePolicyInterface
Expanded class hierarchy of ExcludePages
1 string reference to 'ExcludePages'
1 service uses ExcludePages
File
- src/
PageCache/ ExcludePages.php, line 17
Namespace
Drupal\ape\PageCacheView source
class ExcludePages implements ResponsePolicyInterface {
/**
* A config object for the system performance configuration.
*
* @var \Drupal\Core\Config\Config
*/
protected $config;
/**
* Condition plugin manager.
*
* @var \Drupal\Component\Plugin\Factory\FactoryInterface $plugin_factory
* Factory for condition plugin manager.
*/
protected $conditionManager;
public function __construct(ConfigFactoryInterface $config_factory, FactoryInterface $plugin_factory) {
$this->config = $config_factory
->get('ape.settings');
$this->conditionManager = $plugin_factory;
}
/**
* {@inheritdoc}
*/
public function check(Response $response, Request $request) {
/* @var \Drupal\system\Plugin\Condition\RequestPath $condition */
$condition = $this->conditionManager
->createInstance('request_path');
$condition
->setConfig('pages', $this->config
->get('exclusions'));
if (!empty($this->config
->get('exclusions')) && $condition
->evaluate()) {
return static::DENY;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExcludePages:: |
protected | property | Condition plugin manager. | |
ExcludePages:: |
protected | property | A config object for the system performance configuration. | |
ExcludePages:: |
public | function |
Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: |
|
ExcludePages:: |
public | function | ||
ResponsePolicyInterface:: |
constant | Deny storage of a page in the cache. |