1.20.x cache_database.inc BackdropDatabaseCache::__construct(string $bin)

Constructs a new BackdropDatabaseCache object.

File

drivers/cache_database/cache_database.inc, line 15

Class

BackdropDatabaseCache
Defines a default cache implementation.

Code

function __construct(string $bin) {
  // All cache tables should be prefixed with 'cache_', except for the
  // default 'cache' bin.
  if ($bin != 'cache') {
    $bin = 'cache_' . $bin;
  }
  $this->bin = $bin;

  // Bootstrap the database if it is not yet available.
  if (!function_exists('db_query') || backdrop_get_bootstrap_phase() < BACKDROP_BOOTSTRAP_DATABASE) {
    backdrop_bootstrap(BACKDROP_BOOTSTRAP_DATABASE, FALSE);
  }
}