Comments

chx’s picture

works great. I even have some code for session memcached (mostly written by darix), data memcached , menu memcached, even a patch against taxonomy to cache some expensive functions. NowPublic uses it extensively. Since the v2.0 of PECL client appeared we have not problems, previously we used some PHP client, was not real good.
--
Read my developer blog on Drupal4hu. | The news is Now Public

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

brashquido’s picture

Any chance on sharing those memcache patches?

----------------
Dominic Ryan
www.it-hq.org

morphir’s picture

Url: http://pecl.php.net/package/memcache

/*
Add these functions to bootstrap.inc and replace the original include_once './includes/session.inc'; with a call to
drupal_memcache_init. $conf['memcache_use'] and $conf['memcache_session'] are switching memcache usage.
$conf['memcache_session_server'] is an array of host:port strings.
*/

function _drupal_memcache_init($m) {
  foreach (variable_get($m .'_server', array('localhost:11211')) as $server) {
    list($server, $port) = explode(':', $server);
    if (!isset($GLOBALS[$m])) {
      $GLOBALS[$m] = new Memcache;
      $GLOBALS[$m]->pconnect($server, $port);
    }
    else {
      $GLOBALS[$m]->addserver($server, $port, TRUE);
    }
  }
}

function drupal_memcache_init() {
  if (variable_get('memcache_use', 0)) {
    _drupal_memcache_init('memcache_session');
    _drupal_memcache_init('memcache_cache');
    _drupal_memcache_init('memcache_menu');
  }
  if (variable_get('memcache_use', 0) && variable_get('memcache_session', 0)) {
    include_once './includes/session-memcache.inc';
  }
  else {
    include_once './includes/session.inc';
  };
}

I was also hoping chx could provide with additional information, and maybe code?

morphir.com

brashquido’s picture

That's a good start! Hopefully chx (or someone with Drupal/memcached know how) will see this thread to fill in the blanks...

----------------
Dominic Ryan
www.it-hq.org

mudanoman’s picture

Any updates on using Memcache and Drupal?

I did find: http://www.tenpoundsound.com/blog/2005/11/drupal/memcache-drupal-impleme...

Any help appreciated.

umonkey’s picture

The link is dead. This is is a very interesting topic, it would be great to see it evolve.

mike4miyu’s picture

http://civicrm.org/node/126

I don't have any personal experience with it but looks promising.

brashquido’s picture

As does this;

http://drupal.org/project/memcache

----------------
Dominic Ryan
www.iis-aid.com

marknt15’s picture

Hi. We are using memcached and installed it already in my local machine Snow Leopard 10.6.2 but I had a problem in the patches:
http://drupal.org/node/660036

Here is the screenshot of a sample drupal with memcache module:
http://i.imgur.com/NjwxG.jpg

My question is I don't know how to use it. Will it work as is after the installation or do I need to add some code in order for it to work.

Thanks in advance.

everyz’s picture

Memcache is not always a good choice. In this article you can read details on whether or not to use memcache in your situation