i personally hate to put too much data in the session the less in it the faster the requests are
if there is a chance that you need this data only on some pages and only in the views (not in controller actions where you might get redirected anyway etc) i would put it in a file in tmp/data or whatever and name it like the session id (session_id()) now you can check on the existing file and retrieve the content if you need it alternatively you could hash the session_id(), use the user_id or any other unique key as name and save this key in the session. the session stays very lightweighted - and you still have access to a huge file content. you should have a garbige collector (cronjob) clearing that folder every once in a while On 24 Dez., 12:19, robustsolution <[email protected]> wrote: > you ask a great question > > I forget about putting in database because it should be treated as > permanent storage not temporary/volatile storage > now about file caching. > either you use session or you create your own cache engine. > if the arrays are large I prefer create my own cache engine but > instead of "file_get_contents" the cahced version I "include" it. > > so this is the defference between session (serialized data), and cutom > cache engine (that creates a normal PHP script file to be included > later) > > and the happy new year > On Dec 23, 10:24 pm, Josh <[email protected]> wrote: > > > I have a fairly large array that I would like to access across http > > requests in a given session. > > > Is there a performance disadvantage to putting this in the session > > object? > > > The other option it seems is to put the data in the db, but I have no > > need for this data to persist across sessions, so it seems > > unnecessary. > > > Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
