Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
CodeIgniter

Cache in CodeIgniter

Speed up expensive queries and pages using CodeIgniter’s cache service.

Cache in CodeIgniter — a practical guide to CodeIgniter cache with clear examples you can reuse in real projects.

CodeIgniter Tutorial Series (60/74). Prefer one article? Read the complete CodeIgniter tutorial.

Short description

Cache computed results with a TTL. Clear or refresh when underlying data changes.

Cache remember pattern

$cache = ConfigServices::cache();
$posts = $cache->get('posts_home');
if ($posts === null) {
    $posts = model('PostModel')->published();
    $cache->save('posts_home', $posts, 300); // 5 minutes
}

Leave a reply

Your email address will not be published. Required fields are marked *