- Issue created by @mglaman
- πΊπΈUnited States mglaman WI, USA
This existed in D7 https://git.drupalcode.org/project/memcache/-/blob/7.x-1.x/dmemcache.inc... and did work to handle the max length of key names
// Memcache truncates keys longer than 250 characters[*]. This could lead to // cache collisions, so we hash keys that are longer than this while still // retaining as much of the key bin and name as possible to aid in debugging. // The hashing algorithm used is configurable, with sha1 selected by default // as it performs quickly with minimal collisions. You can enforce shorter // keys by setting memcache_key_max_length in settings.php. // [*]https://github.com/memcached/memcached/blob/master/doc/protocol.txt#L47 $maxlen = variable_get('memcache_key_max_length', 250); foreach ($full_keys as $k => $full_key) { if (strlen($full_key) > $maxlen) { $full_keys[$k] = urlencode($prefix[$k] . $bin) . '-' . hash(variable_get('memcache_key_hash_algorithm', 'sha1'), $key); $full_keys[$k] .= '-' . substr(urlencode($key), 0, ($maxlen - 1) - strlen($full_keys[$k]) - 1); } }
- Status changed to Closed: cannot reproduce
about 2 years ago 7:27pm 24 February 2023 - πΊπΈUnited States mglaman WI, USA
Whoops! It was in the driver class: \Drupal\memcache\Driver\DriverBase::key