Results
12.10.2020
depcalc 8.x-1.x-dev ::
src/Cache/DepcalcCacheFactory.php
namespace Drupal\depcalc\Cache;
use Drupal\Core\Cache\CacheFactoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class to generate Depcalc cache.
*/
class DepcalcCacheFactory implements CacheFactoryInterface {
/**
* The core cache factory.
*
* @var \Drupal\Core\Cache\CacheFactoryInterface
* The core cache factory.
*/
protected $factory;
/**
* The event dispatcher.
/**
* DepcalcCacheFactory constructor.
*
* @param \Drupal\Core\Cache\CacheFactoryInterface $factory
* The core cache factory.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* The event dispatcher.
*/
public function __construct(CacheFactoryInterface $factory, EventDispatcherInterface $dispatcher) {
$this->factory = $factory;
$this->dispatcher = $dispatcher;
}
/**
* {@inheritdoc} 12.10.2020
depcalc 8.x-1.x-dev ::
tests/src/Kernel/ClearCacheTest.php
// Change container to database cache backends.
$container
->register('cache_factory', 'Drupal\Core\Cache\CacheFactory')
->addArgument(new Reference('settings'))
->addMethodCall('setContainer', [new Reference('service_container')]);
}
/**
* {@inheritdoc} 12.10.2020
depcalc 8.x-1.x-dev ::
depcalc.services.yml
cache.factory.depcalc:
class: Drupal\depcalc\Cache\DepcalcCacheFactory
arguments: ['@cache_factory', '@event_dispatcher']
entity.config_entity.dependency_calculator:
class: Drupal\depcalc\EventSubscriber\DependencyCollector\ConfigEntityDependencyCollector
arguments: ['@config.manager']
tags: 15.05.2019
dynamic_config 8.x-1.0-alpha2 ::
src/DynamicConfigYamlDiscovery.php
use Drupal\Component\Discovery\DiscoverableInterface; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Serialization\Yaml; use Drupal\dynamic_config\Helper\DynamicConfigArrayHelper; /** * Class DynamicConfigYamlDiscovery *
$file_cache = FileCacheFactory::get('yaml_discovery:' . static::DISCOVERY_DIR);
foreach ($files_grouped as $module => $files) {
// Try to load from the file cache first.
foreach ($file_cache->getMultiple($files) as $file => $data) {
if (!empty($provider_by_files[$module][$file])) {
$all[$module][$provider_by_files[$module][$file]] = $data; 28.06.2020
entity_browser 8.x-2.x-dev ::
tests/src/Kernel/Extension/EntityBrowserTest.php
namespace Drupal\Tests\entity_browser\Kernel\Extension; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Core\Config\Entity\ConfigEntityStorage; use Drupal\Core\Entity\EntityMalformedException; use Drupal\Core\Form\FormState; use Drupal\entity_browser\DisplayInterface; use Drupal\entity_browser\EntityBrowserInterface;
*/
protected function setUp(): void {
FileCacheFactory::setPrefix($this->randomString(4));
parent::setUp();
$this->controller = $this->container->get('entity_type.manager')->getStorage('entity_browser');
$this->widgetUUID = $this->container->get('uuid')->generate();
$this->routeProvider = $this->container->get('router.route_provider'); 11.08.2020
ex_icons 8.x-1.0 ::
src/Discovery/SvgSymbolDiscovery.php
use Drupal\Component\Discovery\DiscoverableInterface; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\File\FileUrlGeneratorInterface; use Drupal\ex_icons\Serialization\SvgSpriteSheet; /** * Provides discovery for SVG symbol icons within a given set of directories. */
$provider_by_files = array_flip($files);
$file_cache = FileCacheFactory::get('svg_symbol_discovery');
// Try to load from the file cache first.
foreach ($file_cache->getMultiple($files) as $file => $data) {
$all[$provider_by_files[$file]] = $data;
unset($provider_by_files[$file]);
} 11.08.2020
ex_icons 8.x-1.0 ::
tests/src/Unit/SvgSymbolDiscoveryTest.php
namespace Drupal\Tests\ex_icons\Unit; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\File\FileUrlGeneratorInterface; use Drupal\ex_icons\Discovery\SvgSymbolDiscovery; use Drupal\Tests\UnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory;
parent::setUp();
FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]);
}
/**
* Tests the SVG symbol discovery.
*/
public function testDiscovery() { 17.12.2021
external_entity 1.0.x-dev ::
external_entity.services.yml
cache_factory.external_entity:
class: Drupal\Core\Cache\CacheFactory
arguments: ['@settings', external_entity: cache.external_entity.backend.database]
calls:
- [setContainer, ['@service_container']]
cache.external_entity.backend.database:
class: Drupal\external_entity\Cache\ExternalEntityDatabaseBackendFactory 19.09.2019
filecache 8.x-1.0-alpha3 ::
src/Cache/FileSystemBackendFactory.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Component\Serialization\SerializationInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsChecksumInterface; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Site\Settings; /** * Factory for creating FileSystemBackend cache backends.
* Factory for creating FileSystemBackend cache backends.
*/
class FileSystemBackendFactory implements CacheFactoryInterface {
/**
* The service for interacting with the file system.
*
* @var \Drupal\Core\File\FileSystemInterface
*/ 06.02.2020
flysystem_drupal_cache 8.x-1.0-alpha3 ::
src/StackMiddleware/Flysystem.php
use Drupal\Component\Datetime\DateTimePlus; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\File\FileSystem; use Drupal\Core\PageCache\RequestPolicyInterface; use Drupal\flysystem\FlysystemFactory; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\ResponseHeaderBag;
/** * @var \Drupal\Core\Cache\CacheFactoryInterface */ protected $cacheFactory; /** * A policy rule determining the cacheability of a request. * * @var \Drupal\Core\PageCache\RequestPolicyInterface */
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel * The decorated kernel. * @param \Drupal\Core\Cache\CacheFactoryInterface $cacheFactory * The cache bin. * @param \Drupal\Core\PageCache\RequestPolicyInterface $request_policy * A policy rule determining the cacheability of a request. * @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser * Mime Type Guesser. * @param \Drupal\flysystem\FlysystemFactory $flysystemFactory
* Filesystem.
*/
public function __construct(HttpKernelInterface $http_kernel, CacheFactoryInterface $cacheFactory, RequestPolicyInterface $request_policy, MimeTypeGuesserInterface $mimeTypeGuesser, FlysystemFactory $flysystemFactory, FileSystem $filesystem) {
$this->httpKernel = $http_kernel;
$this->cacheFactory = $cacheFactory;
$this->requestPolicy = $request_policy;
$this->mimeTypeGuesser = $mimeTypeGuesser;
$this->flysystemFactory = $flysystemFactory;
$this->filesystem = $filesystem;
} 06.02.2020
flysystem_drupal_cache 8.x-1.0-alpha3 ::
src/Flysystem/DrupalCachePlugin.php
use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\flysystem\Plugin\FlysystemPluginInterface; use Drupal\flysystem\Plugin\FlysystemUrlTrait; use Drupal\flysystem_drupal_cache\DrupalCacheAdapter; use Symfony\Component\DependencyInjection\ContainerInterface;
* DrupalCache constructor. * * @param \Drupal\Core\Cache\CacheFactoryInterface $cacheFactory * Cache Factory. * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cacheTagsInvalidator * Cache Tags Invalidator. * @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser * Cache Tags Invalidator. * @param $bin
* List of cache tags.
*/
public function __construct(CacheFactoryInterface $cacheFactory, CacheTagsInvalidatorInterface $cacheTagsInvalidator, MimeTypeGuesserInterface $mimeTypeGuesser, $bin, $tags) {
$this->cacheBackend = $cacheFactory->get(self::getCacheBin($bin));
$this->cacheTagsInvalidator = $cacheTagsInvalidator;
$this->mimeTypeGuesser = $mimeTypeGuesser;
$this->tags = $tags;
}
/** 12.04.2023
gcsfs 1.0.0-beta2 ::
src/MetadataManager.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Database\Connection; use Drupal\Core\Lock\LockBackendInterface; use Drupal\gcsfs\StreamWrapper\GoogleCloudStorage; /** * Metadata manager class.
* Cache factory. * * @var \Drupal\Core\Cache\CacheFactoryInterface */ protected CacheFactoryInterface $cacheFactory; /** * Database connection. * * @var \Drupal\Core\Database\Connection */
* Constructor. * * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory * The cache factory. * @param \Drupal\Core\Database\Connection $connection * The database connection. * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. * @param \Drupal\Core\Lock\LockBackendInterface $lock
* The lock service.
*/
public function __construct(CacheFactoryInterface $cache_factory, Connection $connection, TimeInterface $time, LockBackendInterface $lock) {
$this->cacheFactory = $cache_factory;
$this->connection = $connection;
$this->time = $time;
$this->lock = $lock;
}
/**
$cid = self::CACHE_PREFIX . $path;
/** @var \Drupal\Core\Cache\CacheBackendInterface $bin */
$bin = $this->cacheFactory->get(self::CACHE_BIN);
$bin->delete($cid);
// Remove from the database.
$this->connection
->delete('gcsfs_object_metadata')
->condition('path', $path)
$cid = self::CACHE_PREFIX . $path;
/** @var \Drupal\Core\Cache\CacheBackendInterface $bin */
$bin = $this->cacheFactory->get(self::CACHE_BIN);
$cache = $bin->get($cid);
if ($cache) {
$metadata[$path] = $cache->data;
}
else {
$cid = self::CACHE_PREFIX . $path;
/** @var \Drupal\Core\Cache\CacheBackendInterface $bin */
$bin = $this->cacheFactory->get(self::CACHE_BIN);
$bin->set($cid, $object_metadata, Cache::PERMANENT, [self::CACHE_TAG]);
// Store in the static cache.
$metadata = &drupal_static(__CLASS__);
$metadata[$path] = $object_metadata; 22.04.2022
gdpr_alert 1.x-dev ::
src/Form/GDPRAlertConfigForm.php
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Language\LanguageManager; use Drupal\Core\State\StateInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\Random;
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory * The cache factory. * @param \Drupal\Core\State\StateInterface $state * The state. * @param \Drupal\Core\Language\LanguageManager $language_manager * The language manager. */
public function __construct(
ConfigFactoryInterface $config_factory,
CacheFactoryInterface $cache_factory,
StateInterface $state,
LanguageManager $language_manager
) {
parent::__construct($config_factory);
$this->cache = $cache_factory->get('render');
$this->state = $state; 22.04.2022
gdpr_alert 1.x-dev ::
src/Form/GDPRAlertSettingsForm.php
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\State\StateInterface; use Drupal\Core\Form\FormStateInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory
* The cache factory.
* @param \Drupal\Core\State\StateInterface $state
* The state.
*/
public function __construct(
ConfigFactoryInterface $config_factory,
public function __construct(
ConfigFactoryInterface $config_factory,
CacheFactoryInterface $cache_factory,
StateInterface $state
) {
parent::__construct($config_factory);
$this->cache = $cache_factory->get('render');
$this->state = $state;
} 16.07.2020
google_analytics_reports 8.x-3.0-rc3 ::
modules/google_analytics_reports_api/src/GoogleAnalyticsReportsApiFeed.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheFactory; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Logger\LoggerChannelFactory; use Drupal\Core\StringTranslation\StringTranslationTrait; use Google\ApiCore\ApiException; use Symfony\Component\DependencyInjection\ContainerInterface;
* The cache factory. * * @var \Drupal\Core\Cache\CacheFactory */ protected $cacheFactory; /** * The time variable. * * @var \Drupal\Component\Datetime\TimeInterface */
* @param Drupal\Core\Logger\LoggerChannelFactory $logger_factory * The logger Factory. * @param Drupal\Core\Cache\CacheFactory $cache_factory * The cache factory. * @param Symfony\Component\HttpFoundation\RequestStack $request_stack * The request service. * @param \Drupal\Component\Datetime\TimeInterface $time * The time service. * @param \Drupal\Core\Messenger\MessengerInterface $messenger
ModuleHandlerInterface $module_handler = NULL,
LoggerChannelFactory $logger_factory = NULL,
CacheFactory $cache_factory = NULL,
RequestStack $request_stack = NULL,
TimeInterface $time = NULL,
MessengerInterface $messenger = NULL
) {
$this->client = $client;
$this->property = $property;
$this->loggerFactory = $logger_factory ? $logger_factory->get('google_analytics_reports_api') : \Drupal::service('cache_factory')->get('google_analytics_reports_api');
// phpcs:ignore
$this->cacheFactory = $cache_factory ? $cache_factory : \Drupal::service('cache_factory');
// phpcs:ignore
$this->requestStack = $request_stack ? $request_stack : \Drupal::service('request_stack');
// phpcs:ignore
$this->time = $time ? $time : \Drupal::service('datetime.time');
// phpcs:ignore
$this->messenger = $messenger ? $messenger : \Drupal::service('messenger');
// Check for DB cache.
$cache = $this->cacheFactory
->get($cache_options['bin']);
$cache = $cache ? $cache->get($cache_options['cid']) : FALSE;
if (
!$cache_options['refresh']
&& isset($cache)
if ($ret) {
$icached[$cache_options['bin']][$cache_options['cid']] = $ret;
$this->cacheFactory
->get($cache_options['bin'])
->set($cache_options['cid'], $ret, $cache_options['expire']);
}
return $ret;
} 16.07.2020
google_analytics_reports 8.x-3.0-rc3 ::
modules/google_analytics_reports_api/tests/src/mock.php
},
],
['Drupal\\Core\\Cache\\CacheFactory', 'cache_factory', function ($item, &$themock) {
$file = $item->getMockBuilder('Drupal\Core\Cache\NullBackend')
->disableOriginalConstructor()
->getMock();
$themock->expects($item->any())
->method('get') 03.02.2018
ide_helper 8.x-2.x-dev ::
tests/expected/Integration/PhpStormMeta/drupal.core.0903.php
'batch.storage' => \Drupal\Core\Batch\BatchStorageInterface::class,
'breadcrumb' => \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface::class,
'cache.backend.apcu' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.chainedfast' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.database' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.memory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.php' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.bootstrap' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.config' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.data' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.default' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.discovery' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.entity' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache_context.user.roles' => \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::class,
'cache_contexts_manager' => \Drupal\Core\Cache\Context\CacheContextsManager::class,
'cache_factory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache_router_rebuild_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'cache_tags.invalidator' => \Drupal\Core\Cache\CacheTagsInvalidatorInterface::class,
'cache_tags.invalidator.checksum' => \Drupal\Core\Cache\CacheTagsChecksumInterface::class,
'class_resolver' => \Drupal\Core\DependencyInjection\ClassResolverInterface::class,
'client_error_response_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'config.factory' => \Drupal\Core\Config\ConfigFactoryInterface::class,
'batch.storage' => \Drupal\Core\Batch\BatchStorageInterface::class,
'breadcrumb' => \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface::class,
'cache.backend.apcu' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.chainedfast' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.database' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.memory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.php' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.bootstrap' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.config' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.data' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.default' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.discovery' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.entity' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache_context.user.roles' => \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::class,
'cache_contexts_manager' => \Drupal\Core\Cache\Context\CacheContextsManager::class,
'cache_factory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache_router_rebuild_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'cache_tags.invalidator' => \Drupal\Core\Cache\CacheTagsInvalidatorInterface::class,
'cache_tags.invalidator.checksum' => \Drupal\Core\Cache\CacheTagsChecksumInterface::class,
'class_resolver' => \Drupal\Core\DependencyInjection\ClassResolverInterface::class,
'client_error_response_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'config.factory' => \Drupal\Core\Config\ConfigFactoryInterface::class, 03.02.2018
ide_helper 8.x-2.x-dev ::
tests/expected/Integration/PhpStormMeta/drupal.core.0900.php
'batch.storage' => \Drupal\Core\Batch\BatchStorageInterface::class,
'breadcrumb' => \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface::class,
'cache.backend.apcu' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.chainedfast' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.database' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.memory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.php' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.bootstrap' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.config' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.data' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.default' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.discovery' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.entity' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache_context.user.roles' => \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::class,
'cache_contexts_manager' => \Drupal\Core\Cache\Context\CacheContextsManager::class,
'cache_factory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache_router_rebuild_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'cache_tags.invalidator' => \Drupal\Core\Cache\CacheTagsInvalidatorInterface::class,
'cache_tags.invalidator.checksum' => \Drupal\Core\Cache\CacheTagsChecksumInterface::class,
'class_resolver' => \Drupal\Core\DependencyInjection\ClassResolverInterface::class,
'client_error_response_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'config.factory' => \Drupal\Core\Config\ConfigFactoryInterface::class,
'batch.storage' => \Drupal\Core\Batch\BatchStorageInterface::class,
'breadcrumb' => \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface::class,
'cache.backend.apcu' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.chainedfast' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.database' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.memory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.backend.php' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache.bootstrap' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.config' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.data' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.default' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.discovery' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache.entity' => \Drupal\Core\Cache\CacheBackendInterface::class,
'cache_context.user.roles' => \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::class,
'cache_contexts_manager' => \Drupal\Core\Cache\Context\CacheContextsManager::class,
'cache_factory' => \Drupal\Core\Cache\CacheFactoryInterface::class,
'cache_router_rebuild_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'cache_tags.invalidator' => \Drupal\Core\Cache\CacheTagsInvalidatorInterface::class,
'cache_tags.invalidator.checksum' => \Drupal\Core\Cache\CacheTagsChecksumInterface::class,
'class_resolver' => \Drupal\Core\DependencyInjection\ClassResolverInterface::class,
'client_error_response_subscriber' => \Symfony\Component\EventDispatcher\EventSubscriberInterface::class,
'config.factory' => \Drupal\Core\Config\ConfigFactoryInterface::class, 22.12.2020
imdb_api 1.0.x-dev ::
src/Plugin/Block/ActorsBornToday.php
* The cache factory.
*
* @var \Drupal\Core\Cache\CacheFactoryInterface
*/
protected $cacheFactory;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = new static($configuration, $plugin_id, $plugin_definition);
$instance = new static($configuration, $plugin_id, $plugin_definition);
$instance->pluginManagerImdbItemsListActor = $container->get('plugin.manager.imdb_items_list.actor');
$instance->cacheFactory = $container->get('cache_factory');
return $instance;
}
/**
* {@inheritdoc}
*/
$build['#attached']['library'][] = 'imdb_api/actor.teaser';
//$cache_bin = $this->cacheFactory->get('default');
$born_today = $this->pluginManagerImdbItemsListActor->createInstance('born_today', ['shuffle' => TRUE, 'limit' => 2, 'options' => [
'day' => date('d'),
'month' => date('m'),
]]); 01.12.2020
ip_login 4.x-dev ::
src/Form/IpLoginSettingsForm.php
use Drupal\Core\DrupalKernelInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /**
* The cache factory. */ protected CacheFactoryInterface $cacheFactory; /** * The cache tags invalidator. */ protected CacheTagsInvalidatorInterface $cacheTagsInvalidator;
public static function create(ContainerInterface $container) {
$instance = parent::create($container);
$instance->cacheFactory = $container->get('cache_factory');
$instance->cacheTagsInvalidator = $container->get('cache_tags.invalidator');
$instance->kernel = $container->get('kernel');
return $instance;
}
/**
// auto-login can be attempted on subsequent page loads, if configured.
if ($auto_login != $old_auto_login || $form_login != $old_form_login || $check_mode != $old_check_mode || $paths != $old_paths) {
$this->cacheFactory->get('render')->deleteAll();
$this->cacheTagsInvalidator->invalidateTags(['ip_login']);
// We need to invalidate the container so the middleware services are
// registered based on the settings above.
// @see \Drupal\ip_login\IpLoginServiceProvider::register()
$this->kernel->invalidateContainer(); 