I am new to codeigniter. I want to use file-based caching.I don’t know if I understood correctly.
1. Declare the following in the parent controller —$this->load->driver('cache');
2. $this->cache->file->save('foo', 'bar', 10); is used to save the file but i don’t know what are the parameters of this function and how to implement all these so that caching can be done.
Please help
I am new to codeigniter. I want to use file-based caching.I don’t know if
Share
http://codeigniter.com/user_guide/libraries/caching.html#example_usage
The manual has it – but it’s a bit hidden in the example:
‘foo’ -> the name for the variable you’re about to cache
$foo -> the variable to cache. It can be anything
300 -> time in seconds (60*5) – set to 0 for no expiry
So IF $foo is empty the cache file is recreated, else you can use $foo to load data.
Further notes:
http://codeigniter.com/user_guide/general/caching.html
A more flexible alternative could be this sparks library:
http://getsparks.org/packages/cache/show
I use it and it fits my needs for file-based caching very well.