Search code examples
phpcodeignitercaching

codeigniter cache returns always empty


I'm try to use the Codeigniter cache system, to cache some remote xml files into "file cache".

Every think looks great when I request the xmls, but codeigniter not cache the files, instead it return a empty cache, and the cache file contains just the data below:

a:3:{s:4:"time";i:1379515910;s:3:"ttl";i:120;s:4:"data";b:1;}

I'm using the code below to cache the xml:

$this->load->driver('cache');
$this->cache->file->save('first', $data, 120);

[UPDATED]

Now I can save the cache, but I can't rescue the saved data. When I run the command below the cache return false

$this->cache->get('show');

Where am I going wrong?

Thanks.


Solution

  • Problem solved, when I call the method to get the current cache I need to pass the used driver e.g.:

    $this->cache->file->get('home');
    OR
    $this->cache->memcached->get('home');
    

    Thanks.