0

I have disabled Cache pages for anonymous users from Drupal admin admin/config/development/performance.

I have set my site to point on 2 domains such as www.ex1.com and www.ex2.com. One domain is for german language and one is for English. All is working fine on my localhost where there is no memcache. But on my live server front page is getting cached.

In settings.php I have settings like below:

$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['memcache_servers'] = array('memcached:11211' => 'default');
$conf['memcache_bins'] = array( 'cache' => 'default', 
        // Any bin that goes to 'none' will fall through to database caching.
        'cache_form' => 'none', );

Do this can help like adding below line ?

$conf['memcache_bins'] = array('cache' => 'default',
                                 'cache_page' => 'pages',
                                 'cache_block' => 'blocks');

setting pages cache to point cache_page.

Please suggest. That will be great if someone can explain that how we stop cache_pages when we are using memcache.

UPDATE: Its happening with only view Titles ie: titles get cache if I visit one domain first and then second. It shows title language from first domain into second domain.

Thanks!

1

This is what you need.

// Turn off page cache
drupal_page_is_cacheable(FALSE);
// Set memcache prefix to be different for each hostname.
$conf['memcache_key_prefix'] = $_SERVER['HTTP_HOST'];
  • Thanks I will test with it and come back with details. That will be great if you can please explain little more. What exactly this will do like I have already disabled cache_page from admin/config/development/performance. – jas Feb 17 '16 at 7:31
  • @jas drupal_page_is_cacheable(FALSE); is the same as turning off caching on the performance page. memcache_key_prefix is how you keep the caches from the 2 sites different. If both sites use the same settings.php then you'll need to use something like $_SERVER['HTTP_HOST'] instead of basename(realpath(conf_path())) (which is the location of the settings.php file). – mikeytown2 Feb 17 '16 at 17:57
  • Thanks for explanation. My case I single site i.e. Shared database and just pointing to 2 domains where I show English language on first domain and other language on second domain with help of entity translations. +1 please check in my question if my configuration need to modify or you can pls update answer. I am confused about this. – jas Feb 17 '16 at 18:01
  • @jas Updated the answer. www.ex1.com will have it's own cache and www.ex2.com will have its own cache. This should take care of the issues you've seen. – mikeytown2 Feb 17 '16 at 18:05
  • 1
    @jas I think you'd be safe then. – mikeytown2 Feb 17 '16 at 18:34

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.