final public function DrupalMemcachedBase::itemKey in Memcache Storage 8
Return the formatted cache key as it will be stored in memcached.
Parameters
$key: Cache item key string.
$cache_bin: Name of the cache bin.
Return value
string Formatted cache key.
6 calls to DrupalMemcachedBase::itemKey()
- DrupalMemcache::deleteMulti in src/
DrupalMemcache.php - Bulk delete from the memcached pool.
- DrupalMemcache::getMulti in src/
DrupalMemcache.php - Get the multiple cache items from the memcached pool.
- DrupalMemcache::setMulti in src/
DrupalMemcache.php - Bulk set if cache items to the memcached pool.
- DrupalMemcached::deleteMulti in src/
DrupalMemcached.php - Bulk delete from the memcached pool.
- DrupalMemcached::getMulti in src/
DrupalMemcached.php - Get the multiple cache items from the memcached pool.
File
- src/
DrupalMemcachedBase.php, line 240
Class
- DrupalMemcachedBase
- Class DrupalMemcachedBase
Namespace
Drupal\memcache_storageCode
public final function itemKey($key, $cache_bin) {
// Build unique cache key.
$cache_key = !empty($this->keyPrefix) ? $this->keyPrefix . '-' : '';
$cache_key .= $cache_bin ? $cache_bin . $this
->getBinIndex($cache_bin) . '-' : '';
$cache_key .= $key;
$cache_key = urlencode($cache_key);
// Memcache only supports key length up to 250 bytes. If we have generated
// a longer key, hash it with md5 which will shrink the key down to 32 bytes
// while still keeping it unique.
if (strlen($cache_key) > 250) {
$cache_key = urlencode(hash($this->hashAlgorithm, $cache_key));
}
return $cache_key;
}