Welcome Guest, Not a member yet? Register   Sign In
Autoload cache drivers
#3

[eluser]Unknown[/eluser]
Why doesn't work?
Code:
class MY_Controller extends CI_Controller {

function __construct()
{
  parent::__construct();

  $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file'));
}
}

On this class:
Code:
class Acl {

private $ci;

function __construct()
{
  $this->ci =& get_instance();

  if (!$foo = $this->ci->cache->get('foo'))
  {
   echo 'Saving to the cache!<br />';
   $foo = 'foobarbaz!';

   // Save into the cache for 5 minutes
   $this->ci->cache->save('foo', $foo, 300);
  }

  echo $foo;
}
}
(Acl is loaded by autoload.php)

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Welcome::$cache

Filename: libraries/Acl.php

Line Number: 13

Fatal error: Call to a member function get() on a non-object in application\libraries\Acl.php on line 13


Messages In This Thread
Autoload cache drivers - by El Forum - 10-24-2012, 07:26 AM
Autoload cache drivers - by El Forum - 10-24-2012, 07:48 AM
Autoload cache drivers - by El Forum - 10-24-2012, 10:07 AM
Autoload cache drivers - by El Forum - 11-05-2012, 11:50 AM
Autoload cache drivers - by El Forum - 11-06-2012, 01:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB