Zend framework Zend_缓存_前端_功能,不工作

Zend framework Zend_缓存_前端_功能,不工作,zend-framework,caching,frontend,Zend Framework,Caching,Frontend,我试图使用Zend_Cache_Frontend_函数来缓存我自己的一些函数调用 缓存的设置如下所示: $manager = new Zend_Cache_Manager(); $frontendOptions = array( 'lifetime' => intval(CACHELIFETIME), 'automatic_serialization' => true); $backendOptions = array('cache_dir' => CACHED

我试图使用
Zend_Cache_Frontend_函数
来缓存我自己的一些函数调用

缓存的设置如下所示:

$manager = new Zend_Cache_Manager();

$frontendOptions = array(
   'lifetime' => intval(CACHELIFETIME),
   'automatic_serialization' => true);

$backendOptions = array('cache_dir' => CACHEDIR);

$funcCache = Zend_Cache::factory('Function',
'File',
$frontendOptions,
$backendOptions);

$manager->setCache('function', $funcCache);
然后我像这样使用缓存:

$country_name = "UK";
$country_id = 1;

$country = new Default_Db_Table_Country();
$country = $cache->call(array($country, "getCountryByName"), array($country_name, $id));
即使多次调用此函数,仍会调用函数
getCountryByName()
,并运行其中的数据库查询

我用得对吗?如何停止多次调用
getCountryByName()

谢谢

编辑:


从源代码看,似乎
call()
使用了输出缓冲,如果是这种情况,那么我的函数什么也不输出,它们只返回对象。因此,在这种情况下,使
Zend\u Cache\u Frontend\u函数
无效?

似乎
Zend\u Cache\u Frontend\u类
是一种方法,而不是
函数
。我需要在每次调用之前设置类,以确保使用正确的对象

$country = new Default_Db_Table_Country();
$cache->setCachedEntity($country);
$country = $cache->getCountryByName($country_name, $id);

此前端确实缓存对象、数组等。

似乎
Zend_cache_Frontend_Class
是一种方式,而不是
功能
。我需要在每次调用之前设置类,以确保使用正确的对象

$country = new Default_Db_Table_Country();
$cache->setCachedEntity($country);
$country = $cache->getCountryByName($country_name, $id);
该前端缓存对象、数组等