The mysql_query function returns a 'resource' handler, which you can not store in memcache.

Try this:

$query = mysql_query("SELECT * FROM ....");
$result  = mysql_fetch_assoc($query);
$memcache_obj->set($key,$result);



Chris Goffinet
[EMAIL PROTECTED]



On Sep 3, 2007, at 11:05 PM, Ajinkya Nahar wrote:

Hi,

I am working on a PHP – Mysql application.
I wanted to ask that can we cache the result set returned by a particular query into memcached? If yes, can we fetch the same result set from memcached and use it without database connection?

E.g.
$query = “SELECT * from ……”;
     $result = mysql_query($query);
     $memcache_obj->set($key, $result);

Will this work??

Please let me know your comments.

Regards,
Ajinkya

Reply via email to