Skip to content

Commit 0b30c72

Browse files
committed
#2867682; Moved hash_algorithm variable.
1 parent 85990bf commit 0b30c72

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/DrupalMemcacheBase.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ abstract class DrupalMemcacheBase implements DrupalMemcacheInterface {
3131
*/
3232
protected $memcache;
3333

34-
/**
35-
* The hash algorithm to pass to hash(). Defaults to 'sha1'
36-
*
37-
* @var string
38-
*/
39-
protected $hashAlgorithm;
40-
4134
/**
4235
* The prefix memcache key for all keys.
4336
*
@@ -54,7 +47,6 @@ abstract class DrupalMemcacheBase implements DrupalMemcacheInterface {
5447
public function __construct(DrupalMemcacheConfig $settings) {
5548
$this->settings = $settings;
5649

57-
$this->hashAlgorithm = $this->settings->get('key_hash_algorithm', 'sha1');
5850
$this->prefix = $this->settings->get('key_prefix', '');
5951
}
6052

src/MemcacheCacheNormalizer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ protected function normalizeKey($key) {
2929
// quickly with minimal collisions.
3030
// Return a string that uses as much as possible of the original cache ID
3131
// with the hash appended.
32-
$hash = hash($this->hashAlgorithm, $this->prefix . '-' . $key);
32+
$hash_algorithm = $this->settings->get('key_hash_algorithm', 'sha1');
33+
$hash = hash($hash_algorithm, $key);
3334
if (!$key_is_ascii) {
3435
return $hash;
3536
}

0 commit comments

Comments
 (0)