首頁  >  文章  >  後端開發  >  PHP有关问题(急)

PHP有关问题(急)

WBOY
WBOY原創
2016-06-13 13:52:28959瀏覽

PHP问题(急)
请各位高手帮忙:下面的缓存代码:怎么样实现每隔15分钟就调用一次钻石榜,魅力榜,职分榜:
//调用缓存
$cacheM = new Seed_Model_Cache2File();
$money_list = $cacheM->get("money_list");
$extcredits2_list = $cacheM->get("extcredits2_list");
$extcredits1_list = $cacheM->get("extcredits1_list");

if (!isset($money_list)){
//钻石榜
$userM = new User_Model_User('user');
$money_list = $userM->fetch_rows(array(0,7), $where_str, array('money desc'));
//echo 111;//测试是否在用缓存;
$cacheM->save("money_list",$money_list);
}
if (!isset($extcredits2_list)){
//魅力榜
$bbsM = new User_Model_Bbs('bbs');
$extcredits2_list = $bbsM->fetch_rows(array(0,7),$where_str,"extcredits2 DESC");
$cacheM->save("extcredits2_list",$extcredits2_list);
}
if (!isset($extcredits1_list)){
//职分榜
$extcredits1_list = $bbsM->fetch_rows(array(0,7),$where_str,"extcredits1 DESC");
$cacheM->save("extcredits1_list",$extcredits1_list);
}

$this->view->money_list = $money_list;
$this->view->extcredits2_list = $extcredits2_list;
$this->view->extcredits1_list = $extcredits1_list;

------解决方案--------------------
使用系统的任务计划。要不就写个死循环;sleep(15*60)shell调用。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn