0
請幫助我... 我無法爲Joomla模塊設置TTL緩存。這是 -Joomla自定義模塊的TTL緩存
$cache->setLifeTime(20);
- 不工作。
我的代碼:
$cache = & JFactory::getCache('my_custom_mod', '');
$cacheKey = (string)$urls->serialize();
if (!($data = $cache->get($cacheKey))){
foreach ($urls as $i => $url){
$data[$i] = file_get_contents($url);
}
$cache->setLifeTime(20);
$cache->store($data, $cacheKey);
}
任何想法?謝謝你的建議。
你能否澄清「不工作」?你有錯誤嗎?是實際執行的代碼?你會得到意想不到的結果? *你期望得到什麼結果? – HPierce
緩存文件在20秒後未更新:$ cache-> setLifeTime(20); – user320038