7

In Drupal 7, a typical setup for Memcache API and Integration was to add this into your settings.php:

  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  $conf['memcache_stampede_protection'] = TRUE;
  $conf['cache_default_class'] = 'MemCacheDrupal';

  // The 'cache_form' bin must be assigned to non-volatile storage.
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

  // Don't bootstrap the database when serving pages from the cache.
  $conf['page_cache_without_database'] = TRUE;
  $conf['page_cache_invoke_hooks'] = FALSE;

Note the importance of the form cache being told to still use the database.

For Drupal 8, the README says you only add:

  $settings['cache']['default'] = 'cache.backend.memcache';

Is there any need to leverage the database for forms in Drupal 8? What line would you add?

6

Drupal 8 does not have a {cache_form} table; in-progress $form_state got moved to the key-value store. The KV store for forms defaults to the database (there are core classes to support database and memory for KV). And the KV store and cache backends are different concepts in Drupal 8 (the former is for persistent data with expiration, the later is for ephemeral data with expiration), so you should be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.