You are here

final class AppCacheByOwnerFactory in Apigee Edge 8

Base definition of the general app cache service for an app owner.

This generates an app cache for apps of a company or a developer.

Hierarchy

Expanded class hierarchy of AppCacheByOwnerFactory

1 string reference to 'AppCacheByOwnerFactory'
apigee_edge.services.yml in ./apigee_edge.services.yml
apigee_edge.services.yml
1 service uses AppCacheByOwnerFactory
apigee_edge.entity.controller.cache.app_cache_by_owner_factory in ./apigee_edge.services.yml
Drupal\apigee_edge\Entity\Controller\Cache\AppCacheByOwnerFactory

File

src/Entity/Controller/Cache/AppCacheByOwnerFactory.php, line 28

Namespace

Drupal\apigee_edge\Entity\Controller\Cache
View source
final class AppCacheByOwnerFactory implements AppCacheByOwnerFactoryInterface {

  /**
   * Internal cache for created instances.
   *
   * @var \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheByOwnerInterface[]
   */
  private $instances = [];

  /**
   * The app name cache by owner factory service.
   *
   * @var \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface
   */
  private $appNameCacheByOwnerFactory;

  /**
   * The app cache service that stores app by their app id (UUID).
   *
   * @var \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheInterface
   */
  private $appCache;

  /**
   * AppCacheByAppOwnerFactory constructor.
   *
   * @param \Drupal\apigee_edge\Entity\Controller\Cache\AppCacheInterface $app_cache
   *   The app cache service that stores app by their app id (UUID).
   * @param \Drupal\apigee_edge\Entity\Controller\Cache\AppNameCacheByOwnerFactoryInterface $app_name_cache_by_owner_factory
   *   The app name cache by owner factory service.
   */
  public function __construct(AppCacheInterface $app_cache, AppNameCacheByOwnerFactoryInterface $app_name_cache_by_owner_factory) {
    $this->appCache = $app_cache;
    $this->appNameCacheByOwnerFactory = $app_name_cache_by_owner_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function getAppCache(string $owner) : AppCacheByOwnerInterface {
    if (!isset($this->instances[$owner])) {
      $this->instances[$owner] = new AppCacheByOwner($owner, $this->appCache, $this->appNameCacheByOwnerFactory);
    }
    return $this->instances[$owner];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AppCacheByOwnerFactory::$appCache private property The app cache service that stores app by their app id (UUID).
AppCacheByOwnerFactory::$appNameCacheByOwnerFactory private property The app name cache by owner factory service.
AppCacheByOwnerFactory::$instances private property Internal cache for created instances.
AppCacheByOwnerFactory::getAppCache public function Returns the same app cache instance for an owner. Overrides AppCacheByOwnerFactoryInterface::getAppCache
AppCacheByOwnerFactory::__construct public function AppCacheByAppOwnerFactory constructor.