Actually, pecl/memcache does the serialization for you. Another nice thing it does.

The problem here is that you can't cache a mysql resource from mysql_query. Its not a result set of data. mysql_query returns a resource to some in memory data that is just not there on subsequent pages.


Brian.
--------
http://brian.moonspot.net/

On 4/16/09 11:22 PM, Adam Donnison wrote:
If you are storing a PHP object you should serialize it,
and unserialize it on the way out.  Otherwise PHP cannot
understand what the object is.

$memcache->set($key, serialize($result));

$result = unserialize($memcache->get($key));

Adam

Paras wrote:
Sorry I forgot to mention, result is of type mysql_result.

Thanks
Paras

On Apr 16, 11:35 pm, Paras<[email protected]>  wrote:
Hello Guys,

I was trying to print a $result which was retrieved from the cache.
Can anyone tell me how I can print the results ?

eg:

$result = $memcache->get($key);

var_dump($result);

does not work. Any ideas ?

Thanks,
Paras


Reply via email to