protected static function MemcacheStorageAPI::getCacheBinCluster in Memcache Storage 7
Get name of cluster where cache bin should be stored. Config loads from settings.php.
Parameters
$bin: Cache bin name. i.e. 'cache' or 'cache_bootstrap'.
Return value
string Cluster name.
1 call to MemcacheStorageAPI::getCacheBinCluster()
- MemcacheStorageAPI::openConnection in ./
memcache_storage.api.inc - Connect to memcached clustes and returns memcached object on success.
File
- ./
memcache_storage.api.inc, line 554 - Provide class that processes memcached operations.
Class
- MemcacheStorageAPI
- Integrates with memcache API.
Code
protected static function getCacheBinCluster($bin) {
// Static variable that stores cache bin
// names and mapped clusters.
static $bin_clusters = array();
// If static cache doesn't contain info about
// mapping then we should load it.
if (empty($bin_clusters[$bin])) {
// Example:
// $conf['memcache_bins'] = array(
// 'cache' => 'default',
// 'cache_bootstrap' => 'default',
// 'cache_page' => 'pages',
// );
$cluster_bins = variable_get('memcache_bins', array());
// Remove suffix from cache bin name.
$cache_bin = self::normalizeCacheBin($bin);
// Get mapped cluster.
$bin_clusters[$bin] = !empty($cluster_bins[$cache_bin]) ? $cluster_bins[$cache_bin] : 'default';
}
return $bin_clusters[$bin];
}