我正在尝试使用 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;
}
但什么也没有发生。我希望脚本会死,但由于某种原因,这个函数永远不会执行。我确定我做错了什么,但有人可以解释如何将缓存(或任何其他对象)注入模块吗?