Performance improvements in Drupal with WINCACHE user cache
Now that WINCACHE 1.1 Beta is released and it has support for user cache, you can enhance Drupal’s performance by integrating WINCACHE user cache. For this you will need to have two things already setup:
- Drupal running
- Drupal extension CacheRouter configured (The below code will work only for latest nightly builds of CacheRouter extension available at http://drupal.org/node/240745/release?api_version%5B%5D=103, 7.0 beta1 and version 5.* and 6.* won’t work)
Once you have above setup ready, integrating WINCACHE user cache is really easy. I will assume that you have copied CacheRouter extension in the ‘modules’ folder of Drupal installation. This means you should have added below lines in your file named settings.php inside folder sites\default:
$conf['cache_inc'] = './modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'wincache',
'servers' => array(),
'shared' => TRUE,
'prefix' => '',
'path' => 'sites/default/files/filecache',
'static' => FALSE,
'fast_cache' => TRUE,
),
);
Now let’s move to next step. Please save the file named wincache.php_.txt from link http://drupal.org/node/743028 as wincache.php file to folder modules\cacherouter\engines.
Restart your server and you are done.
In order to verify that WINCACAHE is storing values in user cache, hit the homepage of your Drupal installation. Now open WINCACHE.PHP file which ships with the installation and click on tab named “User and Session Cache”. It should look something like below:
As of writing this blog, a bug in CacheRouter (daily builds) prevents any caching functionality to work. The bug has been logged at http://drupal.org/node/743238.
In order to make it work with older versions of CacheRouter build like 7.x-1.0-beta1, 6.x-1.0-rc1 or 5.x-1.0-beta9 the attached file at http://drupal.org/node/743028 should be changed. The change is very simple in itself. Just replace the first line excluding comment or line 7 including comment which is:
class wincacheCacheRouterEngine extends CacheRouterEngine {
by the below line:
class wincacheCache extends Cache {
We would like to thank ‘Tauno Hogue’ for providing with the WINCACHE equivalent of cache file.
In this blog post you learnt how to leverage WINCACHE user cache functionality to enhance performance of Drupal. Hopefully this will be useful to you in running Drupal faster on WINDOWS. Happy caching and till we meet again ‘Good Bye’.
Thanks,
Don.
PS: This works only with WINCACHE version 1.1.0 and higher. So please make sure that you are not running any lower versions of WINCACHE like 1.0.0 or 1.0.1.