Yeah, sorry, too late in the afternoon for me.  What I was thinking
(instead of what I was writing) was that you would need to cache the
data, not the resource.  In this sort of situation we tend to fetch
the results into an array and store that in memcached.

Adam - who obviously is in dire need of caffeine.

Brian Moon wrote:
> 
> 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
>>
>>


-- 
Adam Donnison, MySQL Web Developer
Sun Microsystems Australia Pty Ltd
Phone: x47031
Mobile: +61 4 1930 5414
Skype: ajdonnison
Email: [email protected]

Reply via email to