codeigniter cache returns always empty
You've saved it using
$this->cache->file->save('first', $data, 120);
Then get it using the right key
and it should be first
$this->cache->get('first');
Also, to get information about cache
you can use
var_dump($this->cache->cache_info());
Or you may use
var_dump($this->cache->get_metadata('first'));
This is useful for debugging.The get
method accepts cache_item_id
as parameter that you have used when you saved it
get(id['string'])
Check the documentation.
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.