i'm wondering if it's possible to cache a view which is loaded inside another view.
I do:
view.php:
<div>
<?php echo $this->load->view('modules/new_view'); ?>
</div>
so view.php requires a new view inside himself, can i cache the views/modules/new_view.php
content?
Codeigniter has Web Page Caching
CodeIgniter lets you cache your pages in order to achieve maximum performance.
Although CodeIgniter is quite fast, the amount of dynamic information you display in your pages will correlate directly to the server resources, memory, and processing cycles utilized, which affect your page load speeds. By caching your pages, since they are saved in their fully rendered state, you can achieve performance that nears that of static web pages.
To do it you would use the code below where n
is the number of minutes you wish the page to remain cached between refreshes. You can place it anywhere within a function.
$this->output->cache(n);
Update
To cache just a portion of the page, or just a single view, you can use CodeIgniter-Cache.
CodeIgniter-Cache is a partial caching library for CodeIgniter. It allows you to write and get chunks of data to and from the filesystem. By storing complex or large chunks of data in serialized form on the file system you can relieve stress from the database or simply cache Twitter calls.
Another alternative
MP Cache: Simple flexible Caching of parts of code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With