Re: Using PDO with APC
| From: | James McLean | Date: | Fri, 21 Sep 2007 00:29:52 +0000 |
| Subject: | Re: Using PDO with APC | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44021@lists.php.net to get a copy of this message | ||
On 9/20/07, James McLean <james.mclean@gmail.com> wrote:
> Howdy,
>
> I'm attempting to implement APC into my framework, but running into
> some issues. I'm using PostgreSQL 8.2 with PDO, on PHP 5.2.2 running
> on Gentoo Linux.
>
> When ever I attempt to save my result set obtained from the database
> into the APC cache, it throws an exception with the following message:
> 'You cannot serialize or unserialize PDOStatement instances'.
>
> Stack trace shows the __sleep() method on the PDOStatement throws the
> exception when it is called inside apc_store().
>
> I've attempted to use ObjectArray from SPL, however you seem to loose
> the methods on the object, which is clearly no good for me either.
>
> Has anyone got APC working with PDOStatement result sets?
I have resolved this issue, it turned out I was attempting to cache
the incorrect variable. I have outlined the issue and steps to resolve
it on my website:
http://blog.phpguy.org/2007/09/21/apc-and-web-application-performance-take-2/
Cheers
James