Results
10.09.2025
cache_monitor 1.0.x-dev ::
src/Cache/TimingCacheFactory.php
use Drupal\cache_monitor\Metrics\MetricsGateTrait;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\CacheFactoryInterface;
use Drupal\cache_monitor\Metrics\Aggregator;
/**
* Decorates the cache factory and wraps each bin with the timing backend.
*/
class TimingCacheFactory implements CacheFactoryInterface {
/**
* The decorated cache factory.
*
* @var \Drupal\Core\Cache\CacheFactoryInterface
*/
private CacheFactoryInterface $inner;
/**
* The metrics aggregator.
*
* @var \Drupal\cache_monitor\Metrics\Aggregator
*/
/**
* Constructs a new TimingCacheFactory instance.
*
* @param \Drupal\Core\Cache\CacheFactoryInterface $inner
* The decorated cache factory.
* @param \Drupal\cache_monitor\Metrics\Aggregator $agg
* The metrics aggregator.
*/
public function __construct(
CacheFactoryInterface $inner,
Aggregator $agg
) {
$this->inner = $inner;
$this->agg = $agg;
} 10.09.2025
cache_monitor 1.0.x-dev ::
cache_monitor.services.yml
cache_monitor.cache_factory:
class: Drupal\cache_monitor\Cache\TimingCacheFactory
decorates: cache_factory
decoration_priority: 200
arguments: ['@cache_monitor.cache_factory.inner', '@cache_monitor.aggregator']
cache_monitor.storage:
class: Drupal\cache_monitor\Storage\Storage 02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/Controller/Cache/DeveloperAppNameCacheFactory.php
* referenced by its UUID and sometimes by its email address.
*/
final class DeveloperAppNameCacheFactory implements AppNameCacheByOwnerFactoryInterface {
/**
* The (general) app name cache by owner factory service.
*
* @var \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface
*/
/** * DeveloperAppNameCacheFactory constructor. * * @param \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface $app_name_cache_by_owner_factory * The (general) app name cache by app owner factory service. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator
02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/Controller/Cache/DeveloperCache.php
use Apigee\Edge\Entity\EntityInterface; use Drupal\apigee_edge\MemoryCacheFactoryInterface; /** * Default developer cache implementation. * * Generates additional cache entries for developers by using their * email addresses as cache ids. This way developers can be served from
* DeveloperCache constructor.
*
* @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory
* The memory cache factory service.
* @param \Drupal\apigee_edge\Entity\Controller\Cache\EntityIdCacheInterface $entity_id_cache
* The developer entity id cache.
*/
public function __construct(MemoryCacheFactoryInterface $memory_cache_factory, EntityIdCacheInterface $entity_id_cache) {
parent::__construct($memory_cache_factory, $entity_id_cache, 'developer');
}
/**
* {@inheritdoc}
*/ 02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/Controller/Cache/EntityCache.php
use Apigee\Edge\Entity\EntityInterface; use Drupal\apigee_edge\MemoryCacheFactoryInterface; /** * Default entity cache implementation for controllers. * * Always create a dedicated instance from this for an entity type! *
* EntityCache constructor. * * @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory * The memory cache factory service. * @param \Drupal\apigee_edge\Entity\Controller\Cache\EntityIdCacheInterface $entity_id_cache * The related entity id cache. * @param string $entity_type * The entity type. */
* The entity type.
*/
public function __construct(MemoryCacheFactoryInterface $memory_cache_factory, EntityIdCacheInterface $entity_id_cache, string $entity_type) {
$this->cacheBackend = $memory_cache_factory->get("{$entity_type}_entity_cache");
$this->entityIdCache = $entity_id_cache;
}
/**
* {@inheritdoc} 02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/Controller/Cache/DeveloperAppCacheFactory.php
* referenced by its UUID and sometimes by its email address.
*/
final class DeveloperAppCacheFactory implements AppCacheByOwnerFactoryInterface {
/**
* The (general) app cache by owner factory.
*
* @var \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheByOwnerFactoryInterface
*/
/** * DeveloperAppCacheFactory constructor. * * @param \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheByOwnerFactoryInterface $app_cache_by_owner_factory * The (general) app cache by owner factory. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator
02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/Controller/AppController.php
* @var \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheByOwnerFactoryInterface */ private $appByOwnerAppCacheFactory; /** * The app id cache service. * * @var \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface */
public function __construct(SDKConnectorInterface $connector, OrganizationControllerInterface $org_controller, AppCacheInterface $app_cache, AppIdCache $app_id_cache, AppCacheByOwnerFactoryInterface $app_cache_by_owner_factory) {
parent::__construct($connector, $org_controller, $app_cache);
$this->appByOwnerAppCacheFactory = $app_cache_by_owner_factory;
$this->appIdCache = $app_id_cache;
}
/**
* Returns the decorated app controller from the SDK.
*
foreach ($apps_by_owner as $owner => $apps) {
$apps_by_owner_cache = $this->appByOwnerAppCacheFactory->getAppCache($owner);
$apps_by_owner_cache->saveEntities($apps);
$apps_by_owner_cache->allEntitiesInCache(TRUE);
}
}
}
else { 02.10.2020
apigee_edge 8.x-1.17 ::
src/Entity/DeveloperCompaniesCache.php
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\apigee_edge\MemoryCacheFactoryInterface;
/**
* Default non-persistent developer company membership cache implementation.
*/
final class DeveloperCompaniesCache implements DeveloperCompaniesCacheInterface {
* DeveloperCompaniesCache constructor.
*
* @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory
* The memory cache factory service.
*/
public function __construct(MemoryCacheFactoryInterface $memory_cache_factory) {
$this->backend = $memory_cache_factory->get('developer_companies');
}
/**
* {@inheritdoc}
*/ 02.10.2020
apigee_edge 8.x-1.17 ::
src/MemoryCacheFactoryInterface.php
* Base definition of the memory cache factory service.
*/
interface MemoryCacheFactoryInterface {
/**
* Gets a memory cache backend class for a given cache bin.
*
* @param string $bin
* The cache bin for which a cache backend object should be returned. 02.10.2020
apigee_edge 8.x-1.17 ::
src/MemoryCacheFactory.php
* Definition of the Apigee Edge memory cache factory service.
*/
final class MemoryCacheFactory implements MemoryCacheFactoryInterface {
/**
* The default cache bin prefix.
*
* @var string
*/
/**
* MemoryCacheFactory constructor.
*
* @param string|null $prefix
* (Optional) Module specific prefix for the bin.
*/
public function __construct(?string $prefix = NULL) {
$this->prefix = $prefix ?? static::DEFAULT_CACHE_BIN_PREFIX; 02.10.2020
apigee_edge 8.x-1.17 ::
modules/apigee_edge_teams/src/Entity/AppGroupCache.php
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\apigee_edge\MemoryCacheFactoryInterface;
/**
* Default non-persistent developer appgroup membership cache implementation.
*/
final class AppGroupCache implements AppGroupCacheInterface {
* AppGroupCache constructor.
*
* @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory
* The memory cache factory service.
*/
public function __construct(MemoryCacheFactoryInterface $memory_cache_factory) {
$this->backend = $memory_cache_factory->get('developer_companies');
}
/**
* {@inheritdoc}
*/ 02.10.2020
apigee_edge 8.x-1.17 ::
modules/apigee_edge_teams/src/CompanyMembershipObjectCache.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\apigee_edge\MemoryCacheFactoryInterface; /** * Providers a persistent & non-persistent cache for company membership objects. * * @internal You should use the team membership manager service instead of this. */
* CompanyMembershipObjectCache constructor. * * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory * The cache factory. * @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory * The module specific memory cache factory. * @param \Drupal\Core\Config\ConfigFactoryInterface $config * The config factory. * @param \Drupal\Component\Datetime\TimeInterface $time * The system time service. */
* The system time service.
*/
public function __construct(CacheFactoryInterface $cache_factory, MemoryCacheFactoryInterface $memory_cache_factory, ConfigFactoryInterface $config, TimeInterface $time) {
$this->persistentCacheBackend = $cache_factory->get(self::DEFAULT_CACHE_BIN);
// @todo Should we introduce dedicated cache expiration configuration for
// this?
$this->persistentCacheExpiration = $config->get('apigee_edge_teams.team_settings')->get('cache_expiration');
$this->memoryCache = $memory_cache_factory->get('company_membership_object');
$this->systemTime = $time; 02.10.2020
apigee_edge 8.x-1.17 ::
modules/apigee_edge_teams/src/AppGroupMembershipObjectCache.php
use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\apigee_edge\MemoryCacheFactoryInterface; /** * Providers a persistent & non-persistent cache for appgroup membership objects. * * @internal You should use the team membership manager service instead of this. */
* AppGroupMembershipObjectCache constructor. * * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory * The cache factory. * @param \Drupal\apigee_edge\MemoryCacheFactoryInterface $memory_cache_factory * The module specific memory cache factory. * @param \Drupal\Core\Config\ConfigFactoryInterface $config * The config factory. * @param \Drupal\Component\Datetime\TimeInterface $time * The system time service. */
* The system time service.
*/
public function __construct(CacheFactoryInterface $cache_factory, MemoryCacheFactoryInterface $memory_cache_factory, ConfigFactoryInterface $config, TimeInterface $time) {
$this->persistentCacheBackend = $cache_factory->get(self::DEFAULT_CACHE_BIN);
$this->persistentCacheExpiration = $config->get('apigee_edge_teams.team_settings')->get('cache_expiration');
$this->memoryCache = $memory_cache_factory->get('appgroup_membership_object');
$this->systemTime = $time;
} 02.10.2020
apigee_edge 8.x-1.17 ::
apigee_edge.services.yml
apigee_edge.entity.controller.cache.developer_app_cache_factory:
class: Drupal\apigee_edge\Entity\Controller\Cache\DeveloperAppCacheFactory
arguments: ['@apigee_edge.entity.controller.cache.app_cache_by_owner_factory', '@entity_type.manager', '@email.validator']
apigee_edge.entity.controller.cache.developer_app_name_cache_factory:
class: Drupal\apigee_edge\Entity\Controller\Cache\DeveloperAppNameCacheFactory
arguments: ['@apigee_edge.entity.controller.cache.app_name_cache_by_owner_factory', '@entity_type.manager', '@email.validator']
apigee_edge.entity.app_warnings_checker:
class: Drupal\apigee_edge\Entity\AppWarningsChecker
arguments: ['@entity_type.manager', '@datetime.time']
apigee_edge.cache.memory_cache_factory:
class: Drupal\apigee_edge\MemoryCacheFactory
apigee_edge.job_executor:
class: Drupal\apigee_edge\JobExecutor
arguments: ['@database', '@datetime.time', '@queue']
apigee_edge.exception_subscriber: 13.12.2021
awareness 1.0.0-alpha5 ::
src/Cache/CacheFactoryAwareTrait.php
* Trait for classes that utilize cache.factory service.
*/
trait CacheFactoryAwareTrait {
/**
* Returns the requested cache bin.
*
* @param string $bin
* (optional) The cache bin for which the cache object should be returned, 13.12.2021
awareness 1.0.0-alpha5 ::
tests/src/Kernel/AwarenessKernelTest.php
use Drupal\Core\TempStore\SharedTempStoreFactory; use Drupal\Core\TempStore\PrivateTempStoreFactory; use Drupal\awareness\Cache\CacheFactoryAwareTrait; use Drupal\awareness\Cache\MemoryCache\EntityMemoryCacheAwareTrait; use Drupal\awareness\Config\ConfigFactoryAwareTrait; use Drupal\awareness\Context\ContextRespositoryAwareTrait; use Drupal\awareness\Controller\ControllerResolverAwareTrait; use Drupal\awareness\Database\DatabaseAwareTrait; use Drupal\awareness\DateTime\DateFormatterAwareTrait;
class AwarenessKernelTest extends KernelTestBase {
use CacheFactoryAwareTrait;
use ConfigFactoryAwareTrait;
use ContextRespositoryAwareTrait;
use ControllerResolverAwareTrait;
use CurrentUserAwareTrait;
use DatabaseAwareTrait;
use DateFormatterAwareTrait; 08.10.2020
cache_entity_type 1.x-dev ::
src/Entity/Cache/CacheEntityStorage.php
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageBase; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Logger\LoggerChannelFactoryInterface;
* @param \Drupal\Core\Entity\EntityTypeInterface $entityType * The entity type. * @param \Drupal\Core\Cache\CacheFactoryInterface $cacheFactory * The cache factory. * @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memoryCache * The memory cache. * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerChannelFactory * The logger channel factory. * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cacheTagsInvalidator
* The cache tags invalidator.
*/
public function __construct(EntityTypeInterface $entityType, CacheFactoryInterface $cacheFactory, MemoryCacheInterface $memoryCache, LoggerChannelFactoryInterface $loggerChannelFactory, CacheTagsInvalidatorInterface $cacheTagsInvalidator) {
parent::__construct($entityType, $memoryCache);
$this->cacheBackend = $cacheFactory->get(CacheBinNameFactory::binName($this->entityTypeId));
$this->logger = $loggerChannelFactory->get('cache_entity_storage');
$this->cacheTagsInvalidator = $cacheTagsInvalidator;
$this->idMapCacheId = $this->getCacheIdPrefix($this->entityTypeId) . '.id_mapping';
} 08.10.2020
cache_entity_type 1.x-dev ::
modules/cache_entity_type_example/src/Entity/WeeklyWeatherForecastEntityStorage.php
use Drupal\cache_entity_type\Exception\UnsupportedEntityTypeCacheStorageException; use Drupal\cache_entity_type_example\Api\WeeklyWeatherForecastApiClient; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
* @param \Drupal\Core\Entity\EntityTypeInterface $entityType * The entity type. * @param \Drupal\Core\Cache\CacheFactoryInterface $cacheFactory * The cache factory. * @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memoryCache * The memory cache. * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerChannelFactory * The logger channel factory. * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cacheTagsInvalidator
* The API client.
*/
public function __construct(EntityTypeInterface $entityType, CacheFactoryInterface $cacheFactory, MemoryCacheInterface $memoryCache, LoggerChannelFactoryInterface $loggerChannelFactory, CacheTagsInvalidatorInterface $cacheTagsInvalidator, WeeklyWeatherForecastApiClient $apiClient) {
parent::__construct($entityType, $cacheFactory, $memoryCache, $loggerChannelFactory, $cacheTagsInvalidator);
$this->apiClient = $apiClient;
}
/**
* {@inheritdoc} 22.06.2020
cache_metrics 2.0.0 ::
src/CacheFactoryWrapper.php
namespace Drupal\cache_metrics; use Drupal\Core\Cache\CacheFactoryInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Component\HttpFoundation\RequestStack; /** * Wraps a cache factory to register all calls to the cache system. *
* Inspired by webprofiler.
*/
class CacheFactoryWrapper implements CacheFactoryInterface {
/**
* All wrapped cache backends.
*
* @var \Drupal\cache_metrics\CacheBackendWrapper[]
*/
public function __construct(
protected CacheFactoryInterface $cacheFactory,
protected AccountProxyInterface $currentUser,
protected RequestStack $requestStack,
protected array $blacklist,
) {}
/**
if (!$this->isEnabled($bin)) {
// If disabled, return an unwrapped backend.
return $this->cacheFactory->get($bin);
}
if (!isset($this->cacheBackends[$bin])) {
$cache_backend = $this->cacheFactory->get($bin);
$this->cacheBackends[$bin] = new CacheBackendWrapper($cache_backend, $bin, $this->currentUser, $this->requestStack);
}
return $this->cacheBackends[$bin];
}
/** 22.06.2020
cache_metrics 2.0.0 ::
cache_metrics.services.yml
- { name: cache_tags_invalidator }
cache_metrics.cache_factory:
class: Drupal\cache_metrics\CacheFactoryWrapper
public: false
decorates: cache_factory
arguments: ['@cache_metrics.cache_factory.inner', '@current_user', '@request_stack', '%cache_metrics.bins.blacklist%'] 