[dancer-users] Clarification on Dancer instances
Stefan Hornburg (Racke)
racke at linuxia.de
Fri Sep 2 08:33:02 BST 2016
On 09/02/2016 12:25 AM, Chad Wallace wrote:
> On Thu, 1 Sep 2016 14:32:55 -0700
> Amelia Ireland <aireland at lbl.gov> wrote:
>
>> Do instances of a Dancer app stay around between requests, or is the
>> app created when a request comes in, it does its stuff, and then it is
>> destroyed? What happens to variables set with the 'var' keyword: will
>> they persist on a dancer app between requests?
>
> The worker processes persist until reloaded. Any global variables
> (package globals or file-level "my" or "our" variables) will persist.
> I take advantage of this in my webapps to pre-load names and other
> commonly-used and rarely changing stuff at startup to reduce database
> lookups in requests.
>
> To refresh your variables, you could HUP the starman master with this
> command:
>
> $ kill -HUP $(pgrep starman.master)
>
> I'm *pretty sure* variables with "var" are not persistent, but are
> only stored through the life cycle of a single request.
>
That's correct - "var" variables are only present for the current
request.
Regards
Racke
--
Ecommerce and Linux consulting + Perl and web application programming.
More information about the dancer-users
mailing list