> From: Perrin Harkins [mailto:[EMAIL PROTECTED]] > Sent: 12 June 2002 15:11
> You can store anything in Apache::Session; it's just a persistent hash > table. However, storing query results based on a user's session is not > a good idea! What if your users open up two browser windows and tries > to do a search in each one? Server-side session data is global to all > browser windows, so they'll get bizarre and incorrect results. Agreed, but he wasn't talking about storing the results, just the query parameters and current offset / number of rows, which is a-ok for putting into a session. some query session do's and don'ts... Don't forget that you can have multiple sessions - store the query params in a session identified by a query_id so that subsequent requests just say something like: <A HREF='/search&query_id=123456789&action=next'>Next</A> Don't mix transient query sessions with a User Session that stores info about the user's logged in state etc. It would be normal for one user to have multiple queries in a login session Don't bother passing the query ids in cookies, they are not browser session specific. Just use the query_id as a parameter in the first/next/prev/last links as exampled above. You can then have a web control page that handles multiple queries simultaneously Do put the user_id into the query session and check it against the user_id in the User session to prevent query hijack > My suggestions would be to have a separate cache just for query results. Or even to use a database that has a decent approach to caching. MySQL promises automatic cacheable paged queries in the near future. And if you write your own DB cache, you then need to manage the DB / cache synch issues, cache size, cache expiry etc etc issues. Good cache is very hard to do! better to get it from a real data bank. > From: Vuillemot, Ward W [mailto:[EMAIL PROTECTED]] > Sent: 12 June 2002 14:58 > I want to be able to remember the last query so that I can return > results into multple pages along with memory of where in the stack I am at. > The easiest would to be store the query parameters along with the count > information. . .but I do not want to use Apache::Session as I believe > that has too much overhead for this sort of thing. Apache::Session is just what you want here! It is an easy peasy way to remember things on the server, and you can implement it with whatever type of storage underneath that you want [e.g. database] so that you can even share sessions when your query is being served by multiple web servers. If you look through the source, you will see that the overhead is minimal. You can specialise the session persistence mechanism if you want to for example store the key => value pairs as visible records in the DB rather than a serialised blob. Regards Jeff