Re: Sessions running out of storage space - Increase memory?
| From: | Matthew Powell | Date: | Fri, 12 Oct 2007 03:21:11 +0000 |
| Subject: | Re: Sessions running out of storage space - Increase memory? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263130@lists.php.net to get a copy of this message | ||
Dan wrote:
> I need to retrieve a huge amount of data form a database and do so many
> times. To eliminate the overhead of connecting to the database and
> pulling down all that info over and over, I'm trying to pull it down
> only once and stick it into a session. The problem is I get the first
> few results and everything works fine. But then after those first 5 or
> so I only get 0's. My first thought is that this is because of a limit
> on memory that sessions can take up or file size/space where the
> sessions are stored. I looked in the PHP.INI and I didn't find anything
> though.
>
> Any ideas on how to fix this problem or a more elegant solution to my
> huge data needs?
>
> - Dan
APC?
apc_store('some_array',serialize($some_array),86400);
caches $some_array in RAM for 24 hours.
$some_array = unserialize(apc_fetch('some_array'));
brings it back out.
Note - don't do this if you're dealing with massive amounts of data
unique to each session_id, though. Come to think of it... if you're
dealing with massive amounts of data for each session_id, that might be
part of your problem. :)
Matt