开发者

Cache problem with CodeIgniter

I have problems with cache in CodeIgniter.

Then I downloaded cache library for CodeIgniter and put in libraries folder, and put php code in controller file:

<?php

class Cache extends CI_Controller
{
    public function index()
    {
        $this->cache->set('test_cache', 'test_cache_content', 300); // 5 minutes
    }
}

?>

This test_cache cache file isn't in cache folder. In config.php file cache_path is default.

Then I want get test_cache content and put code in controller:

<?php

class Cache extends CI_Controller
{
    public function get()
    {
        $data = $this->cache->get('test开发者_如何转开发_cache');
        echo var_dump($data);
    }
}

?>

Then I see null. I was searching about cache in codeigniter, but nothing.


Just to make sure, because it isn't actually in the code above, you did load a caching driver, right:

// example from CodeIgniter Cache docs.
$this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));

Because if you haven't it defaults to the dummy driver. The dummy driver saves nothing, so I don't think you want that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜