I am getting an error by this title while implementing caching in zend framework Call to a member function load() on a non-object.
Following is code which i googled it online and modified it according to my requirement
<?php
include 'zend/library/Zend/cache.php';
include 'connection.php';
$frontendOptions = array(
'lifetime' => 10,
'automatic_serialization' => true
);
$backendOptions = array(
'cache_dir' => 'tmp/'
);
$cache = Zend_Cache::factory('Core','File', $frontendOptions, $backendOptions);
$id = 'rs';
$start_time = microtime(true);
if(!($data = $cache->load($id))
{
echo "Not found in Cache<br />";
$query ='select * from tablename limit 10';
// $rs = mysql_query($query);
$countsql3 = mysqli_query($mysqli, $query) or die("Cannot Get Pname Info: (".mysql_error().")");
$data = array();
while($row = mysqli_fetch_array($countsql3 ))
{
$data[] = $row;
}
$cache->save($data);
}
else
{
echo "Running from Cache<br />";
}
//echo ‘<pre>’;
//print_r($data);
//echo ‘</pre>’;
//echo sprintf(microtime(true) – $start_time);
?>
Firstly I get error mentioned above but when i remove id in arguments in load function call it throws an error at save methid at bottom.Please help on how to correct this function issues.