CachedDiscoveryClearer.php

Same filename in this branch
  1. 10 core/lib/Drupal/Core/ProxyClass/Plugin/CachedDiscoveryClearer.php
Same filename in other branches
  1. 9 core/lib/Drupal/Core/ProxyClass/Plugin/CachedDiscoveryClearer.php
  2. 9 core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php
  3. 8.9.x core/lib/Drupal/Core/ProxyClass/Plugin/CachedDiscoveryClearer.php
  4. 8.9.x core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php
  5. 11.x core/lib/Drupal/Core/ProxyClass/Plugin/CachedDiscoveryClearer.php
  6. 11.x core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php

Namespace

Drupal\Core\Plugin

File

core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php

View source
<?php

namespace Drupal\Core\Plugin;

use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;

/**
 * Defines a class which is capable of clearing the cache on plugin managers.
 */
class CachedDiscoveryClearer implements CachedDiscoveryClearerInterface {
    
    /**
     * The stored discoveries.
     *
     * @var \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface[]
     */
    protected $cachedDiscoveries = [];
    
    /**
     * {@inheritdoc}
     */
    public function addCachedDiscovery(CachedDiscoveryInterface $cached_discovery) {
        $this->cachedDiscoveries[] = $cached_discovery;
    }
    
    /**
     * {@inheritdoc}
     */
    public function clearCachedDefinitions() {
        foreach ($this->cachedDiscoveries as $cached_discovery) {
            $cached_discovery->clearCachedDefinitions();
        }
    }

}

Classes

Title Deprecated Summary
CachedDiscoveryClearer Defines a class which is capable of clearing the cache on plugin managers.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.