You are here

protected function FileSystemBackendFactory::getCacheStrategyForBin in File Cache 8

Returns the cache strategy for the specified cache bin.

Parameters

string $bin: The cache bin for which to return the cache strategy.

Return value

string The cache strategy, either `FileSystemBackend::DEFAULT` or `FileSystemBackend::PERSIST`.

1 call to FileSystemBackendFactory::getCacheStrategyForBin()
FileSystemBackendFactory::get in src/Cache/FileSystemBackendFactory.php
Returns the FileSystemBackend for the specified cache bin.

File

src/Cache/FileSystemBackendFactory.php, line 121

Class

FileSystemBackendFactory
Factory for creating FileSystemBackend cache backends.

Namespace

Drupal\filecache\Cache

Code

protected function getCacheStrategyForBin($bin) {
  $settings = $this->settings
    ->get('filecache');

  // Look for a cache bin specific setting.
  if (isset($settings['strategy']['bins'][$bin])) {
    $strategy = $settings['strategy']['bins'][$bin];
  }
  elseif (isset($settings['strategy']['default'])) {
    $strategy = $settings['strategy']['default'];
  }
  else {
    $strategy = FileSystemBackend::STANDARD;
  }
  return $strategy;
}