3 namespace Drupal\Core\Plugin;
5 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
8 * Defines a class which is capable of clearing the cache on plugin managers.
10 class CachedDiscoveryClearer implements CachedDiscoveryClearerInterface {
13 * The stored discoveries.
15 * @var \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface[]
17 protected $cachedDiscoveries = [];
22 public function addCachedDiscovery(CachedDiscoveryInterface $cached_discovery) {
23 $this->cachedDiscoveries[] = $cached_discovery;
29 public function clearCachedDefinitions() {
30 foreach ($this->cachedDiscoveries as $cached_discovery) {
31 $cached_discovery->clearCachedDefinitions();