I recently noticed that my cache_page table has a lot of data. It seems that cache is stored in the cache_page table, regardless of the active memcache module. Other tables with data re cache_form (this is OK) and cache_bootstrap?

All other tables go to Memcache. My settings.php contains this:

include_once DRUPAL_ROOT . '/includes/cache.inc';
include_once DRUPAL_ROOT . '/sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array('localhost:11211' => 'default');
$conf['memcache_bins'] = array('cache' => 'default');

Why does the mysql cache_page table get data anyway? I mean, gigabytes of data (in my case), every page is stored in the database.

CommentFileSizeAuthor
#4 1997164-4.patch270 bytesAnonymous (not verified)

Comments

Anonymous’s picture

I'm using pecl memcache 3.0.8 beta

jeffsheltren’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Why are you using include_once instead of the documented "$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';"?

Also, once you enable memcache it won't automatically clear out your DB cache tables, you'll want to do that by hand.

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Active

If I use $conf['cache_backends'][] instead of include_once, it throws a WSOD on every page:

Fatal error: Class 'MemCacheDrupal' not found in /includes/cache.inc on line 31

Yes I have cleared my cache tables. However I can see live hits to cache_page each time I visit a page. Only cache_page is hit, other cache tables are not.

Anonymous’s picture

Status: Active » Needs work
StatusFileSize
new270 bytes

In order for your suggested approach to work, I had to add this line to memcache.info:

files[] = memcache.inc

Otherwise Drupal does not autoload the MemCacheDrupal class and you get a Fatal error (#3). I attached a patch for this. Now my settings.php carries just these three lines:

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

However, the cache_page table still gets hit. I can see this happening real-time! It shows pages with expire: -1 in cache_page. Pages get hit for anonymous users, but I want all anonymous hits to use Memcache as well instead of the database cache_page.

Anonymous’s picture

Title: cache_page always stored in DB, not in Memcache? » Conflict with Domain Access: in settings.php Memcache must come before Domain include
Status: Needs work » Active
Issue tags: +domain access

The problem was Domain Access! The Memcache $conf lines need to come before domain access' include in settings.php. Otherwise Domain Access still hits the cache_page.

Maybe add this to the README.txt?

markpavlitski’s picture

Status: Active » Postponed (maintainer needs more info)

@morningtime Please can you post the section of your settings.php with any Domain Access settings & includes?

markpavlitski’s picture

Status: Postponed (maintainer needs more info) » Active

restoring status

Anonymous’s picture

Ok.

This is the wrong way:

# Domain Access
include_once DRUPAL_ROOT . '/sites/all/modules/contrib/domain/settings.inc';

# Memcache
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

This is the right way:

# Memcache
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

# Domain Access (after Memcache)
include_once DRUPAL_ROOT . '/sites/all/modules/contrib/domain/settings.inc';
markpavlitski’s picture

Status: Active » Closed (works as designed)

@morningtime Many thanks for the info.

It looks like the Domain Access module bootstraps Drupal from that include, which is why it needs to be the last thing in the include file.

INSTALL.txt does say that it needs to be at the end of settings.php, though maybe it's not clear enough.

I'm closing this as a Memcache issue, however you may want to bring this up as a Domain Access documentation issue.

markpavlitski’s picture

Issue summary: View changes

trimmed PHP