I would like to use memcache module to store users' sessions in memcache and cacherouter module to store cache tables in memcache (or elsewhere).

My configuration in settings.php is thus like this:

/* Use custom session handling via memcache */
$conf += array(
  'session_inc' => './sites/all/modules/memcache/memcache-session.inc',
  'memcache_servers' => array(
    'localhost:11211' => 'default',
  ),
  'memcache_bins' => array(
    'session' => 'default',
    'users' => 'default',
  ),
);

/* Use custom cache handling via cacherouter */
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'memcache',
    'servers' => array('localhost:11211'),
    'shared' => TRUE,
    'prefix' => '',
    'path' => NULL,
    'fast_cache' => FALSE,
    'static' => FALSE,
  ),
);

The problem is that when authcache module finds memcache_servers among the variables, it infers that it should use memcache.inc as cache manager.

Comments

sdelbosc’s picture

Status: Active » Needs review
StatusFileSize
new3.36 KB

Authcache checks first memcache configuration and then cacherouter one. I suggest testing first authcache configuration.
Here is a patch that takes this into account.

bennos’s picture

the config above is not right.
memcache-session.inc needs two independend memcache instances.
also "localhost" should not be used in the settings.

This should be better:

$conf += array(
'session_inc' => './sites/all/modules/memcache/memcache-session.inc',
'memcache_servers' => array(
'127.0.0.1:11211' => 'session',
'127.0.0.1:11212' => 'user',
'127.0.0.1:11213' => 'defaul'
),
'memcache_bins' => array(
'session' => 'session',
'users' => 'user',
'cache' => 'default'
),
);

sdelbosc’s picture

Thank you bennos for your post.

You are right, the README.txt file of memcache says: "Note you MUST have a session and a users server set up for memcached sessions to work.".
Actually, I have been using the configuration above for many months on production site and I did not face any isssue. I will investigate on that.

However, the original issue - I cannot use memcache for sessions and cacherouter for cache tables - is still valid. Without the patch above you cannot do that.

simg’s picture

Status: Needs review » Closed (fixed)