tags:

views:

36

answers:

1

It works when I save a simple string. When I save a query result it returns true but I can't read it from the cache anymore.

Here is my code:

$cachekey=md5('mqv_'.$connections[$ccn][5].mysql_result($r,$u,'Tablechoice').$e1.$e2.$e3.$e4.$_SESSION["auszug1"].$_SESSION["per_page1"]);

if($rv = $memcache->get($cachekey)){
     $cachemsg="data from cache: ".$rv;
}else{
     $rv=mysql_query($qc,$link);  print mysql_error($link);
     if($memcache->add($cachekey,$rv,false,60)){
        $cachemsg="data saved".$memcache->getServerStatus('localhost', 11211);
     }
}
if($debug==1){print $cachemsg;}

Thanks for the Help

+1  A: 

You're trying to save the resource link for the resultset rather than the resultset itself. Fetch your results into an array, then save that array to memcache

Mark Baker