DZ论坛怎么自动更新缓存

2025-05-17 16:37:23
推荐回答(1个)
回答1:

以7.2以上的版本为例:
1)在原来缓存机制的基础上建立一个缓存名字段与dateline字段对应的缓存。如cache_dateline.php。
2)写一个getcache函数,每次加载缓存前,先载入cache_dateline.php,然后用cache_缓存名.php(如cache_7u5.php)的修改时间与cache_dataline.php缓存中的dateline值做对比。如果cache_dateline.php中的时间戳大于缓存文件cache_7u5.php的修改时间,则调用更新缓存的页面代码,否则直接加载cache_7u5.php。