I'm trying to get Zend_Cache to work with two different instances of memcached. Both instances are active and listening, I tested this, yet Zend_Cache keeps on cramming everything in the default port of memcached, totally disregarding the second instance. This is my code in my bootstrap:
$backend = array(
'name' => 'Memcached',
'servers' => array( array(
'host' => '127.0.0.1',
'port' => '11211'
) ),
'compression' => true
);
$backend_system = array(
'name' => 'Memcached',
'servers' => array( array(
'host' => '127.0.0.1',
'port' => '11212'
) ),
'compression' => true
);
$systemCache = array(
'frontend' => array(
'name' => 'Core',
'options' => array(
'lifetime' => 7*24*60*60,
'automatic_serialization' => true
)
),
'backend' => $backend_system
);
$dataCache = array(
'frontend' => array(
'name' => 'Core',
'options' => array(
'lifetime' => 1*60*60,
'automatic_serialization' => true
)
),
'backend' => $backend
);
$manager = new Zend_Cache_Manager;
$manager->setCacheTemplate('system', $systemCache);
$manager->setCacheTemplate('data', $dataCache);
Zend_Registry::set( 'manager' , $manager );
What is going wrong here?
And the answer was a simple one: I forgot to enclose my options in an array in the $backend* arrays, like this:
$backend_system = array(
'name' => 'Memcached',
'options' => array(
'servers' => array( array(
'host' => '127.0.0.1',
'port' => '11212'
) ),
'compression' => true
)
);