You are here

class PageCacheRequestPrepareSubscriber in Tome 8

Prepares for a new request when using page cache.

@internal

Hierarchy

Expanded class hierarchy of PageCacheRequestPrepareSubscriber

1 file declares its use of PageCacheRequestPrepareSubscriber
TomeStaticServiceProvider.php in modules/tome_static/src/TomeStaticServiceProvider.php

File

modules/tome_static/src/EventSubscriber/PageCacheRequestPrepareSubscriber.php, line 14

Namespace

Drupal\tome_static\EventSubscriber
View source
class PageCacheRequestPrepareSubscriber implements EventSubscriberInterface {

  /**
   * The resettable page cache.
   *
   * @var \Drupal\tome_static\StackMiddleware\ResettablePageCache
   */
  protected $pageCache;

  /**
   * Constructs the EntityPathSubscriber object.
   *
   * @param \Drupal\tome_static\StackMiddleware\ResettablePageCache $page_cache
   *   The resettable page cache.
   */
  public function __construct(ResettablePageCache $page_cache) {
    $this->pageCache = $page_cache;
  }

  /**
   * Reacts to a collect paths event.
   */
  public function prepareForRequest() {
    $this->pageCache
      ->resetCache();
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[TomeStaticEvents::REQUEST_PREPARE][] = [
      'prepareForRequest',
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PageCacheRequestPrepareSubscriber::$pageCache protected property The resettable page cache.
PageCacheRequestPrepareSubscriber::getSubscribedEvents public static function
PageCacheRequestPrepareSubscriber::prepareForRequest public function Reacts to a collect paths event.
PageCacheRequestPrepareSubscriber::__construct public function Constructs the EntityPathSubscriber object.