3

I have created a one custom table for storing the data, based on cache rules i have created a table.

Installed and enabled Memcache module in site.

Configured memcache in 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;
  $conf['cache_thrive_tips'] = 'DrupalDatabaseCache';
  $conf['memcache_servers'] = array('localhost:11212' => 'default');

When i configure memcache in my site, at that time onwards my custom table(cache_abc) not storing any values.

How can i exclude only this table from memcache?

0

1 Answer 1

6

You do it in the same way the code you are showing does for cache_form.

$conf['cache_class_cache_abc'] = 'DrupalDatabaseCache';

Adding that line in the settings.php file, you are telling Drupal to save the cache for cache_abc in the database.

Keep in mind that, in Drupal cache terminology, cache_abc (which would be the name of the database table containing the cache data, when the cache is saved in the database) is called bin.

3
  • you're code is working fine,thanks for you're help.
    – RaMeSh
    Dec 30, 2016 at 12:59
  • how can we configured for drupal 8 Jun 23, 2020 at 14:43
  • For Drupal 8, see Cache API, in particular the part after A module can define a cache bin by defining a service in its modulename.services.yml file as follows (substituting the desired name for "nameofbin").
    – apaderno
    Jun 23, 2020 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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