CI默认的cache_on 一旦开启,永远不失效,除非自己删除。比较弱智。
CI database/DB_dirver.php 中 1021行 cache_on 函数替换为
CI database/DB_cache.php 中 90行 read 函数 if (FALSE === ($cachedata = read_file($filepath))) 一行前面加上
在需要开启数据库缓存的地方写: $this→db→cache_on($SEC); $SEC 为需要缓存的秒数。 0 为永不过期。 如 $this→db→cache_on(3); 表示缓存3秒。3秒后自动失效。
转载自:红麦软件 http://www.teamwiki.cn/