[Mongrel] Recommentation: Sessions and PStore
jacob at jacobatzen.dk
Mon Sep 4 11:02:19 EDT 2006
On Sun, Sep 03, 2006 at 09:18:06AM -0700, Zed Shaw wrote:
> 2) DON'T STORE COMPLEX OBJECTS IN THE SESSION!
> This especially goes for you Java people who think the session store is
> a temporary database. The session really only works for simple types
> like integers, strings, etc. You *must* follow the mantra of "Share
> Nothing" and either store everything in the database or use form fields
> and GET parameters to make it stateless. As I've said repeatedly, "If
> rails-core don't do it, you don't do it." Rails-core does not do this.
> You don't do it.
This piece of advice I find a little troubling. Often you have to store
a lot of data temporarily in your application, f.ex. with multipage form
submissions. Having to store only simple types will make this much more
complicated compared to simply storing a single object in the session
which is repeatedly updated until stored in the database.
Is the data in the session not simply marshalled and then read back on
the next request? If so, what is the difference between simple and
complex types, they should marshal and unmarshal equally well, yes?
Am I missing something here?
- Jacob Atzen
More information about the Mongrel-users