diff --git a/README.txt b/README.txt index 4da39ce9b94a235db08b1810de457b32ce63ad98..b19a5855e89a4db9636e13b72c2ced9f7a80a413 100644 --- a/README.txt +++ b/README.txt @@ -106,7 +106,7 @@ The memcache-lock.inc file included with this module can be used as a drop-in replacement for the database-mediated locking mechanism provided by Drupal core. To enable, define the following in your settings.php: -$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc'; + $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc'; Locks are written in the 'semaphore' table, which will map to the 'default' memcache cluster unless you explicitly configure a 'semaphore' cluster. @@ -116,11 +116,12 @@ memcache cluster unless you explicitly configure a 'semaphore' cluster. Memcache includes stampede protection for rebuilding expired and invalid cache items. To enable stampede protection, define the following in settings.php: -$conf['memcache_stampede_protection'] = TRUE; + $conf['memcache_stampede_protection'] = TRUE; To avoid lock stampedes, it is important that you enable the memacache lock implementation when enabling stampede protection -- enabling stampede protection -without enabling the Memache lock implementation can cause worse performance. +without enabling the Memache lock implementation can cause worse performance and +can result in dropped locks due to key-length truncation. Memcache stampede protection is primarily designed to benefit the following caching pattern: a miss on a cache_get() for a specific cid is immediately diff --git a/memcache.install b/memcache.install index 104595f5c99b0f79a244470a25af0e6edbd0e38f..f3626f93c63365e6927e755d53fc4ac2a17672c3 100644 --- a/memcache.install +++ b/memcache.install @@ -142,6 +142,12 @@ function memcache_requirements($phase) { // An unexpected exception occurred. $errors[] = $t('Unexpected failure when testing memcache configuration.'); } + // Core's lock implementation can cause worse performance together with + // stampede protection. Plus, long keys will be truncated resulting in + // dropped locks. + if (variable_get('memcache_stampede_protection', FALSE) && strpos(variable_get('lock_inc', 'includes/lock.inc'), 'includes/lock.inc') !== FALSE) { + $warnings[] = $t('Drupal\'s core lock implementation (%core) is not supported by memcache stampede protection. Enable the memcache lock implementation (%memcache) or disable memcache stampede protection.', array('%core' => 'includes/lock.inc', '%memcache' => drupal_get_path('module', 'memcache') . "/memcache-lock.inc")); + } } if (!empty($errors)) { @@ -150,11 +156,11 @@ function memcache_requirements($phase) { $errors = array_merge($errors, $warnings); unset($warnings); $requirements['memcache_extension']['severity'] = REQUIREMENT_ERROR; - $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration, check the Drupal logs for additional errors. Please review %readme for help resolving the following !issue: !errors', array('%readme' => 'README.txt', '!issue' => format_plural(count($errors), 'issue', 'issues'), '!errors' => '