supesite自动更新资讯缓存
1,在function/cache_function.php中添加函数
| /** * 更新资讯cache */ function updatenewsdbcache() { global $_SGLOBAL; dbconnect(); $subs = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); $_SGLOBAL['db']->query('TRUNCATE TABLE '.tname('cache')); //分表 foreach ($subs as $tbl) { $_SGLOBAL['db']->query('TRUNCATE TABLE '.tname('cache_'.$tbl)); } } |
2,在include/cron下新建updatedbcache.php
| if(!defined('IN_SUPESITE')) { exit('Access Denied'); } include_once(S_ROOT.'./function/cache.func.php'); // 更新supesite数据库缓存 updatenewsdbcache(); |
3,supesite管理后台的计划任务中添加此计划,蘑菇设置为10分钟,由于更新缓存对服务器的压力有所增加,所以请各位同学按各自需要更新。



