[web-devel] Re: State in Yesod
michael at snoyman.com
Wed Nov 24 18:59:01 CET 2010
On Wed, Nov 24, 2010 at 6:04 PM, Dmitry Olshansky <olshanskydr at gmail.com> wrote:
> Hello all,
> can I save in Yesod on server-side some information between different
> requests (State)?
> I haven't found how to do this.
Yes you can, but not by using a State monad. You basically have two choices:
* Store inside the Yesod process, using something like an MVar or
TVar. This will work fine, unless you are using multiple Yesod
processes to serve requests (odds are, you aren't).
* Store state in the database.
But if you just want to store a small amount of data about the user,
you can use the session, which stores the data encrypted in a cookie.
I can give you better advice if I know what the purpose of this is.
More information about the web-devel