codeigniter tutorial

CodeIgniter Active Record Caching

Active Record caching helps you to save some parts of your database queries so that you can reuse them at a later point in your script’s execution. Usually, when a query is executed all of the query related information is reset for the next query. Active record caching gives you way to prevent this reset, and reuse query information easily. Cached calls works in cumulative fashion, making 2 cached select() calls, and then 2 uncached select() calls, will result in 4 select() calls.

In CodeIgniter, we have following three active record caching functions


This function is used to start query caching.


This function is used to stop query caching.


This function is used to delete all items from the Active Record cache.






//Generates: SELECT `field1` FROM (`tablename`)


Note:- The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set