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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 1997164-4.patch | 270 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) commentedI'm using pecl memcache 3.0.8 beta
Comment #2
jeffsheltren commentedWhy 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.
Comment #3
Anonymous (not verified) commentedIf I use $conf['cache_backends'][] instead of include_once, it throws a WSOD on every page:
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.
Comment #4
Anonymous (not verified) commentedIn order for your suggested approach to work, I had to add this line to memcache.info:
Otherwise Drupal does not autoload the
MemCacheDrupalclass and you get a Fatal error (#3). I attached a patch for this. Now my settings.php carries just these three lines:However, the
cache_pagetable 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.Comment #5
Anonymous (not verified) commentedThe 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?
Comment #6
markpavlitski commented@morningtime Please can you post the section of your settings.php with any Domain Access settings & includes?
Comment #7
markpavlitski commentedrestoring status
Comment #8
Anonymous (not verified) commentedOk.
This is the wrong way:
This is the right way:
Comment #9
markpavlitski commented@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.
Comment #9.0
markpavlitski commentedtrimmed PHP