dongtazu3080 2013-04-21 09:54 采纳率: 100%
浏览 45
已采纳

Zend框架清除缓存

I'm using this code to cache an array in zend framework :

$frontendOptions = array(
    'lifetime' => 24 * 3600 * 7, // cache lifetime of 7 day
    'automatic_serialization' => true
);

$backendOptions = array(
    // Directory where to put the cache files
    'cache_dir' => APPLICATION_PATH .'/../tmp'
);

// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
    'File',
    $frontendOptions,
    $backendOptions);

$CacheName = ('VOUCHER_MANAGEMENT');

$CacheResult = $cache->load($CacheName);

if($CacheResult === false)
    //make cache
else 
    //use cache

Now how can I clear the cache manually?

  • 写回答

1条回答 默认 最新

  • doubu5035 2013-04-21 10:16
    关注

    According to the documentation a single call of the remove() method would suffice, i.e. to remove a specific cache item:

    $cache->remove($CacheName);
    

    If you want to clean the outdated cache items, then call the clean() method:

    $cache->clean(Zend_Cache::CLEANING_MODE_OLD);
    

    To remove all items in the cache:

    $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么