[Dancer-users] Using shared variables

Gurunandan Bhat gbhat at pobox.com
Wed Jan 25 09:15:33 CET 2012


On Wed, Jan 25, 2012 at 5:07 AM, Flavio Poletti <polettix at gmail.com> wrote:

> On Wed, Jan 25, 2012 at 12:54 AM, damien krotkine <dkrotkine at gmail.com>
>  wrote:
>
>>
>> There is the 'vars' function to store a state variable between requests.
>>
>
> On Tue, Jan 24, 2012 at 8:54 PM, Gurunandan Bhat <gbhat at pobox.com> wrote:
>
>> Thanks Damien. I see now that vars is the best way to go.
>
>
> I'm certainly not as aware of Dancer internals as Damien, but I would
> think that this is not the way to go actually. It is my understanding that
> the "vars" mechanism more or less boils down to what failed for you, and
> that there is absolutely no effort to synchronize the vars across multiple
> processes.
>
> I think David got it right:
>
> You should use the 'vars' keyword if you need to share stuff between a
>> single request, and use sessions (or e.g. memcached) to maintain state
>> between requests.
>
>
> A shared data source - database, memcached, whatever - seems to be the
> right choice to save your server-side state.
>
> Cheers,
>
>    Flavio.
>

Thanks. I used simple server side session and it all works now. The data is
too small (a few keys into a larger data structure) to use a database or
memcache.

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20120125/ed1013e1/attachment.htm>


More information about the Dancer-users mailing list