Hi,
Just for the record, I'm using Windows Vista with XAMPP (PHP 5.3.1).
I'm trying to use APC to cache a database result. I did a simple APC test on string variables and it seems to work ok. However, when I try to do the same thing with a database result resource, I get a complaint the data in the cache 'is not a valid MySQL result resource' whenever I want to use it.
Here is my code:
$key_hash_str = md5($query_sql_str);
$cache_res = Mox_Cache_APC::fetch($key_hash_str);;
switch(true)
{
case (!$cache_res):
$query_result_res = self::executeQuery($query_sql_str);
Mox_Cache_APC::store($key_hash_str, $query_result_res);
return $query_result_res;
break;
default:
return $cache_res;
}
Mox_Cache_APC is my APC class and fetch and store are just abstractions for apc_fetch() and apc_store(). executeQuery is a static function defined within the class were this code is written (as is evident, for executing the Query).
Am I doing something wrong? Is there something I need to do to the resultset before caching it?
Kindly advise.