考虑这个示例代码:
$storyID = 1;
$detailsCache = 'details'.$storyID;
if(!apc_exists($detailsCache)){
$phases_details = <<<SQL
SELECT stp.stp_id,
stp.stp_name,
stp.stp_position,
FROM story_phase stp
WHERE stp.stp_stl_id = $storyID
SQL;
$resultdetails = Helpers::execute_query($phases_details,"Get phase details failed.");
**// i cant cache the result here like apc_store($detailsCache, $phases_details);**
}
$result_phases_details = apc_fetch($detailsCache);
while($row = mysql_fetch_assoc($result_phases_details)){
// some logic
}
有更好的方法来缓存结果吗?