public function DrupalMemcacheBase::key in Zircon Profile 8
Same name and namespace in other branches
- 8.0 modules/memcache/src/DrupalMemcacheBase.php \Drupal\memcache\DrupalMemcacheBase::key()
Prepares the memcache key.
Parameters
string $key: The raw cache key.
Return value
string The prepared cache key.
Overrides DrupalMemcacheInterface::key
6 calls to DrupalMemcacheBase::key()
- DrupalMemcache::getMulti in modules/
memcache/ src/ DrupalMemcache.php - Retrieves multiple values from Memcache.
- DrupalMemcache::set in modules/
memcache/ src/ DrupalMemcache.php - Adds an item into memcache.
- DrupalMemcacheBase::delete in modules/
memcache/ src/ DrupalMemcacheBase.php - Deletes an item from Memcache.
- DrupalMemcacheBase::get in modules/
memcache/ src/ DrupalMemcacheBase.php - Retrieves a value from Memcache.
- DrupalMemcached::getMulti in modules/
memcache/ src/ DrupalMemcached.php - Retrieves multiple values from Memcache.
File
- modules/
memcache/ src/ DrupalMemcacheBase.php, line 84 - Contains \Drupal\memcache\DrupalMemcacheBase.
Class
- DrupalMemcacheBase
- Class DrupalMemcacheBase.
Namespace
Drupal\memcacheCode
public function key($key) {
$full_key = urlencode($this->bin . '-' . $key);
// Memcache only supports key lengths up to 250 bytes. If we have generated
// a longer key, we shrink it to an acceptable length with a configurable
// hashing algorithm. Sha1 was selected as the default as it performs
// quickly with minimal collisions.
if (strlen($full_key) > 250) {
$full_key = urlencode(hash($this->hashAlgorithm, $this->bin . '-' . $key));
}
return $full_key;
}