Skip to content

Commit a8e8824

Browse files
committed
#2867682; Corrected normalization of lock key.
1 parent 0b30c72 commit a8e8824

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/DrupalMemcacheBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
abstract class DrupalMemcacheBase implements DrupalMemcacheInterface {
1616

17-
use MemcacheCacheNormalizer;
17+
use MemcacheCacheNormalizerTrait;
1818

1919
/**
2020
* The memcache config object.

src/MemcacheBackend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
class MemcacheBackend implements CacheBackendInterface {
1919

20-
use MemcacheCacheNormalizer;
20+
use MemcacheCacheNormalizerTrait;
2121

2222
/**
2323
* The cache bin to use.
@@ -130,7 +130,7 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
130130
* @return bool
131131
*/
132132
protected function valid($cid, \stdClass $cache) {
133-
$lock_key = "memcache_$cid:$this->bin";
133+
$lock_key = $this->normalizeKey("memcache_$cid:$this->bin");
134134
$cache->valid = FALSE;
135135

136136
if ($cache) {

src/MemcacheCacheNormalizer.php renamed to src/MemcacheCacheNormalizerTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Class MemcacheCacheNormalizer.
77
*/
8-
trait MemcacheCacheNormalizer {
8+
trait MemcacheCacheNormalizerTrait {
99

1010
/**
1111
* Normalizes a cache ID in order to comply with key length limitations.
@@ -29,6 +29,7 @@ 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+
/** @var DrupalMemcacheConfig $this->settings */
3233
$hash_algorithm = $this->settings->get('key_hash_algorithm', 'sha1');
3334
$hash = hash($hash_algorithm, $key);
3435
if (!$key_is_ascii) {

0 commit comments

Comments
 (0)