- class indexController extends grace{
- //根据缓存情况设置、读取缓存数据
- public function index(){
- $this->cache('test', 12, '__getData');
- p($this->test);
- }
- echo '无缓存,进行查询...<br />';
- $db = db('persons');
- $persons = $db->fetchAll();
- return $persons;
- }
- //删除指定的缓存
- $this->removeCache('test', '12');
- }
- //清空缓存
- public function t2(){
- $this->clearCache();
- }