0
我正在尝试将缓存注入到使用module.config.php而没有运气的模块中。我module.config.php看起来像这样将缓存注入模块
return array(
'di' => array(
'instance' => array(
'AssetLoader\Module' => array(
'parameters' => array(
'cache' => 'Zend\Cache\Storage\Adapter\Filesystem',
),
),
),
),
);
,并在我的Module.php
public function setCache(\Zend\Cache\Storage\Adapter\Filesystem $cache)
{
die(__FUNCTION__);
$this->cache = $cache;
}
但没有任何反应。我期望脚本死掉,但由于某种原因,这个函数从未被执行。我相信我做错了什么,但是有人可以解释如何在模块中注入缓存(或其他任何对象)?