Skip to content
Snippets Groups Projects

Issue #3516912: add fallback for MemoryBackend

Open Chris Dart requested to merge issue/drupal-3516912:3516912-pantheon-builds-fail into 11.x
@@ -29,13 +29,25 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
*/
protected $cache = [];
/**
* @var \Drupal\Component\Datetime\TimeInterface
*/
protected TimeInterface $time;
/**
* Constructs a MemoryBackend object.
*
* @param \Drupal\Component\Datetime\TimeInterface $time
* @param \Drupal\Component\Datetime\TimeInterface|null $time
* The time service.
*/
public function __construct(protected TimeInterface $time) {
public function __construct(?TimeInterface $time = NULL) {
// Gracefully handle legacy calls to the constructor without a time service.
if ($time === NULL) {
$this->time = \Drupal::time();
}
else {
$this->time = $time;
}
}
/**
@@ -198,8 +210,7 @@ public function invalidateAll() {
/**
* {@inheritdoc}
*/
public function garbageCollection() {
}
public function garbageCollection() {}
/**
* {@inheritdoc}
Loading