I added this in my index funtion
$this->output->set_cache_header('Cache-Control: no-cache, must-revalidate');
But an error was occured.
An uncaught Exception was encountered
Type: ArgumentCountError
Message: Too few arguments to function CI_Output::set_cache_header(), 1 passed in C:\xampp\htdocs\lsc\application\controllers\Home.php on line 24 and exactly 2 expected
Filename: C:\xampp\htdocs\lsc\system\core\Output.php
Line Number: 792
Backtrace:
File: C:\xampp\htdocs\lsc\application\controllers\Home.php
Line: 24
Function: set_cache_header
File: C:\xampp\htdocs\lsc\index.php
Line: 315
Function: require_once
Can someone tell me how to use this?
I want to set the cache for my website and tell me how to use the cache in website
If you want to prevent caching, use the set_header
function instead:
$this->output->set_header('Cache-Control: no-cache, must-revalidate', TRUE);
If you want to enable caching, pass two timestamp values to the function set_cache_header
:
$this->output->set_header(time(), strtotime('+1 days'));
/**
* Set Cache Header
*
* Set the HTTP headers to match the server-side file cache settings
* in order to reduce bandwidth.
*
* @param int $last_modified Timestamp of when the page was last modified
* @param int $expiration Timestamp of when should the requested page expire from cache
* @return void
*/
public function set_cache_header($last_modified, $expiration)