CodeIgniter Forums
Trying to use MP_Cache but cant find class definition - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Trying to use MP_Cache but cant find class definition (/showthread.php?tid=43593)



Trying to use MP_Cache but cant find class definition - El Forum - 07-17-2011

[eluser]Unknown[/eluser]
I am trying to use the MP_Cache (https://bitbucket.org/jschreuder/mp_cache/). It seems to save the cache file alright but when I try to load it I get this error:

Quote:Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;CI_DB_mysql_result&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/victorsigma/timmithoydiles.com/application/views/test.php on line 20

In my controller is:
Code:
class TestPage extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->library('MP_Cache');
    }
    
    function index()
    {    
        
        $query = $this->mp_cache->get('recent_thumbs');
        if ($query === false)
        {
            $query = $this->skins->get_random(4);
            $this->mp_cache->write($query, 'recent_thumbs',15);
        }
        
        if ($query->num_rows() > 0)
            echo "SUCCESS";
}}