You are here

protected static function DrupalAPCCache::getPrefixSettingForBin in APC - Alternative PHP Cache 7

Get prefix for bin using the configuration.

Parameters

string $bin:

Return value

string Can be an empty string, if no prefix set.

1 call to DrupalAPCCache::getPrefixSettingForBin()
DrupalAPCCache::__construct in ./drupal_apc_cache.inc

File

./drupal_apc_cache.inc, line 57
This integrates the drupal APC cache backend.

Class

DrupalAPCCache
APC cache implementation.

Code

protected static function getPrefixSettingForBin($bin) {
  $prefixes = variable_get('cache_prefix', '');
  if (is_string($prefixes)) {

    // Variable can be a string, which then considered as a default behavior.
    return $prefixes;
  }
  if (isset($prefixes[$bin])) {
    if (FALSE !== $prefixes[$bin]) {

      // If entry is set and not FALSE, an explicit prefix is set for the bin.
      return $prefixes[$bin];
    }
    else {

      // If we have an explicit false, it means no prefix whatever is the
      // default configuration.
      return '';
    }
  }
  else {

    // Key is not set, we can safely rely on default behavior.
    if (isset($prefixes['default']) && FALSE !== $prefixes['default']) {
      return $prefixes['default'];
    }
    else {

      // When default is not set or an explicit FALSE, this means no prefix.
      return '';
    }
  }
}