Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache library not loading

I have got an error while loading cache library in codeigniter(2.1.3). What it is saying is this:

An Error Was Encountered

Unable to load the requested class: cache

My Code Looks like this

if (!$data['foo'] = $this->cache->file->get('details')) {
        $data['foo'] = $this->foo->getdetails();
        $this->cache->file->save('details', $data['foo'], 600);
    }

My autoload file is like this:

$autoload['libraries'] = array('database','form_validation','session','driver','cache');
like image 341
Ali Avatar asked Aug 20 '26 09:08

Ali


1 Answers

Hi every body i got the answer of this issue.

Finally i made a custom library and call that in my autoload file. it solved my problem.

and The Code is here

class CallCache  {

public function __construct($config = array())
{
            $ci = &get_instance();
            $ci->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file')); 
}
}       

Finally Thank God

like image 173
Ali Avatar answered Aug 22 '26 15:08

Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!