![]() |
How to reuse a query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: How to reuse a query (/showthread.php?tid=80489) |
How to reuse a query - JerryCode - 11-08-2021 The user table has 20 rows. PHP Code: //1.create a query My solution is to use caching cache()->save('result',$result); // save cache $count = cache(‘result’)->countAllResults(); //10 results, use cache $all = $result->findAll(); //10 results , if use pagination, can not use cache data here cache()->delete('result'); //delete cache |