final function GenericCacheBackendUnitTestBase::getCacheBackend

Gets a backend to test; this will get a shared instance set in the object.

Return value

Drupal\Core\Cache\CacheBackendInterface Cache backend to test.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php, line 98
Definition of Drupal\system\Tests\Cache\GenericCacheBackendUnitTestBase.

Class

GenericCacheBackendUnitTestBase
Tests any cache backend.

Namespace

Drupal\system\Tests\Cache

Code

final function getCacheBackend($bin = null) {
  if (!isset($bin)) {
    $bin = $this
      ->getTestBin();
  }
  if (!isset($this->cachebackends[$bin])) {
    $this->cachebackends[$bin] = $this
      ->createCacheBackend($bin);

    // Ensure the backend is empty.
    $this->cachebackends[$bin]
      ->deleteAll();
  }
  return $this->cachebackends[$bin];
}