views:

146

answers:

1

Hi,

I am developing lots of custom modules for my web application and needs to implement memcache with it. I have installed and enabled memcache module in my drupal installation but now I have to see what data is being cached.

Is there any additional work required to cache my module specific data? Also, What is the exact work flow of caching mechanism in Drupal?

Regards,

A: 

Once set up correctly the memcache module overrides the standard Drupal cache functions, so your module dosen't need to be memcache aware. It will use memcache on systems with it enabled and standard Drupal db caching elsewhere.

The memcache module requires a bit more work to enable than most other modules.

These are the broad steps you need to take in order to use this software. Order is important.

  1. Install the memcached binaries on your server. See How to install Memcache on Debian Etch or How to install Memcache on OSX
  2. Install the PECL memcache extension for PHP.
  3. In php.ini set memcache.hash_strategy="consistent".
  4. Put your site into offline mode.
  5. Download and install the memcache module.
  6. If you have previously been running the memcache module, run update.php.
  7. Apply the DRUPAL-5-cache-serialize.patch that comes with the module to your Drupal installation.
  8. Start at least one instance of memcached on your server.
  9. Edit settings.php to configure the servers, clusters and bins that memcache is supposed to use.
    1. Edit settings.php to include either memcache.inc or memcache.db.inc. For example, $conf['cache_inc'] ='sites/all/modules/memcache/memcache.db.inc';
    2. Bring your site back online.

Once installed and running you can telnet to the memcache instance on your server (11211 I belive is the default port) and type get *cache-key* to see if your data has been cached.

Jeremy French