Blogs | Srijan

Demandbase module caching issue

Written by Team Srijan | Jul 24, 2012 7:00:00 AM

Demandbase module caching issue

During development of demandbase module we faced the drupal caching issue. Demandbase module provides context conditions those will be checked  and will fire context reaction accordingly based upon visitor ip address. You can find more about demandbase drupal module and demandbase services here. Drupal support caching for both anonymous and authenticated users. In early stage of development we were using drupal default caching. Drupal's defaul caching create single cache instance for each page for all anonymous user. If you want to use this feature with demandbase module then it will cause problem and it will show same page to all anonymous user even if context are fired.

To resolve this issue Demandbase module provides provides its own caching mechanism. This module enable separate caching  for all anonymous user. Demandbase module provides two submodules for caching:

1. Demandbase cache

Demandbase cache submodule override drupal default caching and enable separate caching for each anonymous user. you can limit this separate caching for specific pages only.

2. Demandbase memcache

Demandbase memcache submodule uses very popular memcache caching mechanism for separate caching for each anonymous user. To use this submodule you should have memcached service running at your server and configured accordingly. To configure memcache read the README.txt file of this module. And you should have installed php extension for memcache. To install memcached service and  php memcache extension on fedora run these commands 

yum install memcached

yum install php-pecl-memcache

For ubuntu run these commands:

apt-get install memcached

apt-get install php5-memcache

After installing start the memcached service and restart your server.

After starting memcached service and installing php memcache extension you should select Demandbase memcache option under DEMANDBASE CACHE page. This will use memcache for caching for all pages. You can limit caching for specific pages only. 

Note: During development if you face error then you should restart memcache service because memcache service will cache erroneous pages too.