2010-07-27 95 views
0

它在我保存簡單字符串時起作用。當我保存查詢結果時,它會返回true,但我無法再從緩存中讀取它。Memcache:爲什麼我找不到查詢結果

這裏是我的代碼:

$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;} 

感謝您的幫助

+1

歡迎光臨!我格式化了你的代碼。看看「如何格式化」,這是在每個編輯窗口右上角,這很容易(你也可以編輯你自己的問題)。 – Abel 2010-07-27 08:20:23

+0

謝謝,在我的下一篇文章中,我將自己設計我的代碼 – Martin 2010-07-27 08:44:30

回答

1

您正試圖保存的結果集,而不是結果集自身的資源鏈接。將結果提取到數組中,然後將該數組保存到memcache中

相關問題