I now see 'session' appearing in the bin entries 3 times, which I assume to be heading in the right direction. I have the following code fire on hook_init:

    // if there is no key use the user info
    if (!$key) {
        if (is_object($user) && $user->sid) $key = $user->sid;
        else return;
        drupal_set_message('user=' . $key);
    }


    if (($sessionData = dmemcache_get($key, 'session')) == NULL) {
        drupal_set_message('Memcache write: ' . ($mw = dmemcache_set($key, $user, 60, 'session')) ? 'success' : 'fail');
        $sessionData = dmemcache_get($key, 'session');
    }
    drupal_set_message('<pre>' . print_r($sessionData,1) . '</pre>');

So basically if the current session is not cached (the read comes back empty), I have memcache set it and read it again. The second read is successful. However, reloading the page Always displays 'success', which means the write is always occurring, which means the cache retrieval is failing either because I'm doing it wrong or because it's not really cached (though I don't know why the second read would work each time).

Of course, I don't want to request the session to be cached.. it should be automatic.

-------- Original Message --------
Subject: [support] Getting memcache to cache sessions
From: <jeff@ayendesigns.com>
Date: Tue, May 15, 2012 12:03 pm
To: support@drupal.org

I have memcache installed, and the UI turned on, and it generates statistics for get, set, etc. However it does not generate anything for session caching, and a call to dmemcache_get(session id, 'session') comes back empty.

Here are the applicable settings from settings.php

$conf['cache_inc'] = $_SERVER['cache_inc']; 'this is set elsewhere and contains the valid path
$conf['memcache.hash_strategy']="consistent";
if (isset($_SERVER['HTTP_USER_AGENT']) && !preg_match("/(?:cron\.php|install\.php)/", $_SERVER['REQUEST_URI'])) {
  if (isset($_SERVER['HTTP_HOST'])) {
      $conf += array(
          'cache_default_class' => 'MemCacheDrupal',
          'session_inc'      => './sites/all/modules/contrib/memcache/memcache-session.inc',
           'memcache_servers' => array(
                  'localhost:11211' => 'default',
                  'localhost:11215' => 'session',
                  'localhost:11216' => 'users',
                  ),
           'memcache_bins' => array(
                'cache' => 'default',
                'session' => 'session',
                'users' => 'users',
               ),
  );
  }


--
[ Drupal support list | http://lists.drupal.org/ ]