
| Current Path : /var/www/html/rocksensor3/web/core/lib/Drupal/Core/Cache/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor3/web/core/lib/Drupal/Core/Cache/MemoryBackendFactory.php |
<?php
namespace Drupal\Core\Cache;
use Drupal\Component\Datetime\TimeInterface;
class MemoryBackendFactory implements CacheFactoryInterface {
/**
* Instantiated memory cache bins.
*
* @var \Drupal\Core\Cache\MemoryBackend[]
*/
protected $bins = [];
/**
* Constructs a MemoryBackendFactory object.
*
* @param \Drupal\Component\Datetime\TimeInterface|null $time
* The time service.
*/
public function __construct(protected ?TimeInterface $time = NULL) {
if (!$time) {
@trigger_error('Calling ' . __METHOD__ . '() without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3387233', E_USER_DEPRECATED);
$this->time = \Drupal::service(TimeInterface::class);
}
}
/**
* {@inheritdoc}
*/
public function get($bin) {
if (!isset($this->bins[$bin])) {
$this->bins[$bin] = new MemoryBackend($this->time);
}
return $this->bins[$bin];
}
}