Caching 从Symfony 1.4中的批处理文件访问缓存
我正在尝试从Symfony 1.4中的批处理文件访问缓存Caching 从Symfony 1.4中的批处理文件访问缓存,caching,symfony-1.4,batch-file,Caching,Symfony 1.4,Batch File,我正在尝试从Symfony 1.4中的批处理文件访问缓存 //lib/batch/test.php require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); // first try $filecache =
//lib/batch/test.php
require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
// first try
$filecache = new sfFileCache(array(
'cache_dir' => sfConfig::get('sf_template_cache_dir'),
'automatic_cleaning_factor' => 0,
'prefix' => '/Library/WebServer/Documents/mywebsite/apps/frontend/template'));
$cache = new sfViewCacheManager(sfContext::createInstance($configuration), $filecache);
//always false
var_dump($cache->has('chart/index'));
//second try
$class = sfConfig::get('sf_factory_view_cache', 'sfFileCache');
$filecache = new $class(sfConfig::get('sf_factory_view_cache_parameters', array (
'automatic_cleaning_factor' => 0,
'cache_dir' => '/Library/WebServer/Documents/mywebsite/cache/frontend/dev/template',
'lifetime' => 86400,
'prefix' => '/Library/WebServer/Documents/mywebsite/apps/frontend/template',
)));
$cache = new sfViewCacheManager(sfContext::createInstance($configuration), $filecache, array (
'cache_key_use_vary_headers' => true,
'cache_key_use_host_name' => true,
));
//always false
var_dump($cache->has('chart/index'));
通过模块/操作访问缓存的结果不同(在相同的开发环境中)
我比较了两个缓存对象(批处理与模块/操作),它们完全相同
有什么想法吗
多谢各位
public function executeTest()
{
$cache = $this->getContext()->getViewCacheManager();
//always true
var_dump($cache->has('chart/index'));
return sfView::NONE;
}