You are here

class PageCacheRequestPolicy in Domain Access 8

A page cache request policy.

This service is not meant to DO anything, it's just meant to represent a service that might be present in the Drupal community. For example, persistent_login module has this same structure.

Hierarchy

Expanded class hierarchy of PageCacheRequestPolicy

1 string reference to 'PageCacheRequestPolicy'
domain_config_hook_test.services.yml in domain_config/tests/modules/domain_config_hook_test/domain_config_hook_test.services.yml
domain_config/tests/modules/domain_config_hook_test/domain_config_hook_test.services.yml
1 service uses PageCacheRequestPolicy
domain_config_service.page_cache_request_policy in domain_config/tests/modules/domain_config_hook_test/domain_config_hook_test.services.yml
Drupal\domain_config_hook_test\PageCache\RequestPolicy\PageCacheRequestPolicy

File

domain_config/tests/modules/domain_config_hook_test/src/PageCache/RequestPolicy/PageCacheRequestPolicy.php, line 17

Namespace

Drupal\domain_config_hook_test\PageCache\RequestPolicy
View source
class PageCacheRequestPolicy implements RequestPolicyInterface {

  /**
   * Drupal config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactory
   */
  protected $configFactory;

  /**
   * Constructor.
   *
   * @param \Drupal\Core\Config\ConfigFactory $config_factory
   *   Drupal config factory.
   */
  public function __construct(ConfigFactory $config_factory) {
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function check(Request $request) {

    // This line is important. You have to use this service for it to fail.
    $this->configFactory
      ->get('system.site');
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PageCacheRequestPolicy::$configFactory protected property Drupal config factory.
PageCacheRequestPolicy::check public function Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface::check
PageCacheRequestPolicy::__construct public function Constructor.
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.