final class MemoryCacheFactory in Apigee Edge 8
Definition of the Apigee Edge memory cache factory service.
Hierarchy
- class \Drupal\apigee_edge\MemoryCacheFactory implements MemoryCacheFactoryInterface
Expanded class hierarchy of MemoryCacheFactory
1 string reference to 'MemoryCacheFactory'
1 service uses MemoryCacheFactory
File
- src/
MemoryCacheFactory.php, line 29
Namespace
Drupal\apigee_edgeView source
final class MemoryCacheFactory implements MemoryCacheFactoryInterface {
/**
* The default cache bin prefix.
*
* @var string
*/
private const DEFAULT_CACHE_BIN_PREFIX = 'apigee_edge';
/**
* Module specific cache bin prefix.
*
* @var string
*/
private $prefix;
/**
* Instantiated memory cache bins.
*
* @var \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface
*/
private $bins;
/**
* 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;
}
/**
* {@inheritdoc}
*/
public function get($bin) : MemoryCacheInterface {
$bin = "{$this->prefix}_{$bin}";
if (!isset($this->bins[$bin])) {
$this->bins[$bin] = new MemoryCache();
}
return $this->bins[$bin];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MemoryCacheFactory:: |
private | property | Instantiated memory cache bins. | |
MemoryCacheFactory:: |
private | property | Module specific cache bin prefix. | |
MemoryCacheFactory:: |
private | constant | The default cache bin prefix. | |
MemoryCacheFactory:: |
public | function |
Gets a memory cache backend class for a given cache bin. Overrides MemoryCacheFactoryInterface:: |
|
MemoryCacheFactory:: |
public | function | MemoryCacheFactory constructor. |