Results
24.07.2022
cache_review 1.0.x-dev ::
src/Render/RenderCacheReview.php
use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\Context\CacheContextsManager; use Drupal\Core\Cache\VariationCacheFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Render\Markup; use Drupal\Core\Render\PlaceholderGeneratorInterface; use Drupal\Core\Render\PlaceholderingRenderCache; use Drupal\Core\Routing\CurrentRouteMatch; use Symfony\Component\HttpFoundation\RequestStack;
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory for retrieving required config objects.
* @param \Drupal\Core\Cache\VariationCacheFactoryInterface $cache_factory
* The variation cache factory.
*/
public function __construct(PlaceholderingRenderCache $original_placeholdering_render_cache, array $renderer_config, CurrentRouteMatch $current_route_match, RequestStack $request_stack, CacheContextsManager $cache_contexts_manager, PlaceholderGeneratorInterface $placeholder_generator, ConfigFactoryInterface $config_factory, VariationCacheFactoryInterface $cache_factory) {
$this->placeholderingRenderCache = $original_placeholdering_render_cache;
$this->rendererConfig = $renderer_config;
$this->currentRouteMatch = $current_route_match;
$this->configFactory = $config_factory;
parent::__construct($request_stack, $cache_factory, $cache_contexts_manager, $placeholder_generator);
if ($this->isElementCacheable($elements) &&
($cache_bin = $this->cacheFactory->get($bin)) &&
($cache = $cache_bin->get($elements['#cache']['keys'], CacheableMetadata::createFromRenderArray($elements)))) {
$cached_element = $cache->data;
if (isset($cached_element['#cache_redirect'])) {
return $this->parentGet($cached_element); 19.06.2018
cache_split 8.x-1.x-dev ::
src/Cache/SplitBackendFactory.php
namespace Drupal\cache_split\Cache; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Site\Settings; use Symfony\Component\DependencyInjection\ContainerAwareTrait; /** * Factory for cache split backend. */
* Factory for cache split backend.
*/
class SplitBackendFactory implements CacheFactoryInterface {
use ContainerAwareTrait;
/**
* @var array
*/
$factory = $this->container->get($backend);
// Check if we got a cache factory here.
if (!$factory instanceof CacheFactoryInterface) {
throw new \Exception(sprintf('Services "%s" does not implement CacheFactoryInterface', $backend));
}
return $factory->get($bin);
}
} 27.06.2020
commerce_xero 8.x-1.x-dev ::
tests/src/Unit/CommerceXeroDataTestTrait.php
use Drupal\Component\Plugin\Discovery\AttributeClassDiscovery; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\TypedData\Attribute\DataType; use Drupal\Core\TypedData\ComplexDataDefinitionInterface; use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\Core\TypedData\ListDataDefinition; use Drupal\Core\TypedData\Plugin\DataType\Any;
$this->typedDataManagerProphet = $this->prophesize('\Drupal\Core\TypedData\TypedDataManagerInterface');
FileCacheFactory::setPrefix(FileCacheFactory::DISABLE_CACHE);
// There is no good method to figure out the app root so make two educated
// guesses: directly under modules or under modules/contrib (qa.drupal.org).
// @todo this no longer works on GitLab CI due to directory changes.
$root = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)));
if (!realpath($root . '/core')) {
$root = dirname($root); 27.06.2020
commerce_xero 8.x-1.x-dev ::
tests/src/Unit/CommerceXeroProcessorManagerTest.php
use Drupal\commerce_xero\CommerceXeroProcessorManager; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\Cache\NullBackend; use Drupal\Tests\UnitTestCase; use Prophecy\Argument; /** * Tests the commerce xero processor plugin manager.
protected function setUp(): void {
parent::setUp();
FileCacheFactory::setPrefix(FileCacheFactory::DISABLE_CACHE);
$moduleHandlerProphet = $this->prophesize('\Drupal\Core\Extension\ModuleHandlerInterface');
$moduleHandlerProphet
->alter(
'commerce_xero_process_process',
Argument::type('\Drupal\Core\TypedData\ComplexDataInterface'), 14.05.2024
component_connector 1.1.0 ::
src/ComponentConnectorManager.php
namespace Drupal\component_connector; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Utility\NestedArray; use Drupal\component_connector\Plugin\Layout\ComponentConnectorLayout; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Layout\LayoutDefinition;
$mask = '/^.*\.' . $type . '\.yml$/';
$theme = $this->themeHandler->getTheme($this->themeName);
$file_cache = FileCacheFactory::get('component_connector:' . $type);
$files = $this->fileSystem->scanDirectory($theme->getPath(), $mask, ['key' => 'uri']);
$all = [];
// Try to load from the file cache first.
foreach ($file_cache->getMultiple(array_keys($files)) as $file => $data) {
$all[$file] = $data;
unset($files[$file]); 20.10.2020
confi 8.x-2.0-rc1 ::
src/ConfigImporterService.php
use Drupal\Core\Config\ConfigImporter; use Drupal\Component\Uuid\UuidInterface; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Drupal\Core\Extension\ThemeExtensionList; /**
protected $directory = ''; /** * Configuration of FileCacheFactory. * * @var array */ private $fileCacheConfig = []; /** * ThemeExtensionList definition.
// Save current configuration to disable file cache for a while
// and restore afterwards.
$this->fileCacheConfig = FileCacheFactory::getConfiguration();
// @see https://www.drupal.org/node/2758325
FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]);
// Sync directory must be configured.
$this->setDirectory(Settings::get('config_sync_directory') );
}
/**
* Restore file cache configuration.
*/
public function __destruct() {
FileCacheFactory::setConfiguration($this->fileCacheConfig);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) { 20.04.2021
config_override 8.x-1.x-dev ::
tests/Unit/SiteConfigOverridesTest.php
namespace Drupal\config_override\Tests\Unit {
use Drupal\Component\FileCache\FileCacheFactory;
use Drupal\Component\Serialization\Yaml;
use Drupal\config_override\SiteConfigOverrides;
use Drupal\Core\Cache\CacheBackendInterface;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
// Set file cache factory prefix to prevent the below exception.
// InvalidArgumentException: Required prefix configuration is missing.
FileCacheFactory::setPrefix('test');
vfsStream::setup('drupal');
vfsStream::create([
'sites' => [
'default' => [
'config' => [ 20.04.2021
config_override 8.x-1.x-dev ::
tests/Unit/ModuleConfigOverridesTest.php
namespace Drupal\config_override\Tests\Unit; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Serialization\Yaml; use Drupal\config_override\ModuleConfigOverrides; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ModuleHandlerInterface; use org\bovigo\vfs\vfsStream;
// Set file cache factory prefix to prevent the below exception.
// InvalidArgumentException: Required prefix configuration is missing.
FileCacheFactory::setPrefix('test');
$module_info = <<<MODULE_INFO
name: Virtual module
type: module
description: 'Description.'
core_version_requirement: '*' 16.06.2020
coveo 1.0.0-alpha1 ::
src/API/SecurityCacheFactory.php
* @see https://platform.cloud.coveo.com/docs?urls.primaryName=SecurityCache#/
*/
class SecurityCacheFactory {
/**
* API factory service.
*
* @var \Drupal\coveo\API\ApiFactory
*/ 16.06.2020
coveo 1.0.0-alpha1 ::
src/API/OrganizationApiHelper.php
public readonly FieldApiFactory $fieldApiFactory,
public readonly PushApiFactory $pushApiFactory,
public readonly SecurityCacheFactory $securityCacheFactory,
) {}
} 16.06.2020
coveo 1.0.0-alpha1 ::
src/Entity/CoveoOrganization.php
*/
public function securityCacheCreate(string $class): mixed {
return $this->getApiHelper()->securityCacheFactory
->create(
$class,
$this->getPushKey(),
);
} 16.06.2020
coveo 1.0.0-alpha1 ::
coveo.services.yml
# Security Cache/Provider API Factory.
coveo.rest.security_cache_factory:
class: Drupal\coveo\API\SecurityCacheFactory
arguments: ['@coveo.rest.client']
# Source APIs Factory.
coveo.rest.source_api_factory:
class: Drupal\coveo\API\SourceApiFactory
arguments: ['@coveo.rest.client'] 09.11.2022
crowdriff_api 1.x-dev ::
src/Form/CrowdriffConfigForm.php
namespace Drupal\crowdriff_api\Form; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; 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.
*/
public function __construct(ConfigFactoryInterface $config_factory, CacheFactoryInterface $cache_factory) {
parent::__construct($config_factory);
$this->cache = $cache_factory->get('crowdriff');
}
/**
* {@inheritdoc} 09.11.2022
crowdriff_api 1.x-dev ::
src/CrowdriffService.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Component\Serialization\SerializationInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandler; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\Messenger\MessengerTrait;
* @param \Drupal\Core\Config\ConfigFactoryInterface $config * The config. * @param \Drupal\Core\Cache\CacheFactoryInterface $cache * The cache factory. * @param \GuzzleHttp\ClientInterface $client * The client. * @param \Drupal\Component\Datetime\TimeInterface $time * The time. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
LoggerChannelFactoryInterface $loggerFactory,
ConfigFactoryInterface $config,
CacheFactoryInterface $cache,
ClientInterface $client,
TimeInterface $time,
EntityTypeManagerInterface $entity_type_manager,
FileRepositoryInterface $file_repository,
KeyRepository $keyRepository,
ModuleHandler $module_handler 24.07.2020
currency 8.x-3.3 ::
tests/src/Unit/ConfigImporterTest.php
use Commercie\Currency\ResourceRepository; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Extension\Extension; use Drupal\Core\Extension\ModuleHandlerInterface;
$method_get->setAccessible(TRUE);
FileCacheFactory::setPrefix('prefix');
$extension = $this->createMock(Extension::class);
$this->moduleHandler->expects($this->atLeastOnce())
->method('getModule')
->willReturn($extension); 20.12.2022
dcache 1.0.x-dev ::
src/CoreFix/MemoryCacheFactory.php
namespace Drupal\dcache\CoreFix;
use Drupal\Core\Cache\CacheFactoryInterface;
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCache;
class MemoryCacheFactory implements CacheFactoryInterface, CacheTagsInvalidatorInterface {
/**
* Instantiated memory cache bins.
*
* @var \Drupal\Core\Cache\MemoryCache\MemoryCache[]
*/ 20.12.2022
dcache 1.0.x-dev ::
src/DCacheFactoryInterface.php
use Drupal\Core\Cache\CacheBackendInterface;
interface DCacheFactoryInterface {
public function get(CacheBackendInterface ...$cacheBackends);
} 20.12.2022
dcache 1.0.x-dev ::
src/DCacheFactory.php
use Drupal\Core\Cache\CacheBackendInterface;
class DCacheFactory implements DCacheFactoryInterface {
public function get(CacheBackendInterface ...$cacheBackends) {
return DCache::create(...$cacheBackends);
}
} 20.12.2022
dcache 1.0.x-dev ::
dcache.services.yml
# Work around https://www.drupal.org/project/drupal/issues/2973286
dcache.cache.factory.memory:
class: Drupal\dcache\CoreFix\MemoryCacheFactory
tags:
- { name: cache_tags_invalidator}
cache.dcache_default_memory:
class: Drupal\Core\Cache\CacheBackendInterface
factory: [ '@dcache.cache.factory.memory', 'get' ]
arguments: [ dcache_default_memory ]
- { name: cache.bin, default_backend: cache.backend.database }
dcache.factory:
class: Drupal\dcache\DCacheFactory
arguments: []
dcache.bin.default_memory_persistent:
class: Drupal\dcache\DCacheInterface
factory: [ '@dcache.factory', 'get' ]
arguments: [ '@cache.dcache_default_memory', '@cache.dcache_default_persistent' ] 04.05.2019
decoupled_config 8.x-1.0-alpha1 ::
src/DecoupledConfigYamlDiscovery.php
use Drupal\Component\Discovery\DiscoverableInterface; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Serialization\Yaml; use Drupal\decoupled_config\Helper\DecoupledConfigArrayHelper; /** * Class DecoupledConfigYamlDiscovery. *
$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; 