You are here

public function JsProxyCache::__construct in JS Callback Handler 7.2

Constructs a JS cache handler.

Parameters

string $bin: The cache bin name.

File

src/JsProxyCache.php, line 81

Class

JsProxyCache
JS custom cache handler.

Code

public function __construct($bin) {
  if (isset(static::$conf[static::DEFAULT_BIN_KEY])) {
    $bin_key = 'cache_class_' . $bin;
    $class = isset(static::$conf[$bin_key]) ? static::$conf[$bin_key] : static::$conf[static::DEFAULT_BIN_KEY];
    $this->backend = new $class($bin);
  }
  else {
    $message = 'The cache backend configuration for the JS proxy cache handler is invalid: @conf';
    throw new LogicException(format_string($message, array(
      '@conf' => print_r(static::$conf, TRUE),
    )));
  }
}