我正在尝试让Zend_Cache使用两个不同的memcached实例。这两个实例都是活动的并且正在监听,我对此进行了测试,但Zend_Cache继续在memcached的默认端口中填充所有内容,完全忽略了第二个实例。这是我的引导程序中的代码:
$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 );
这里出了什么问题?
答案 0 :(得分:1)
答案很简单:我忘了将我的选项放在$ backend *数组的数组中,如下所示:
$backend_system = array(
'name' => 'Memcached',
'options' => array(
'servers' => array( array(
'host' => '127.0.0.1',
'port' => '11212'
) ),
'compression' => true
)
);