Clarification on Dancer instances
Hi all, I'm trying to solve a mysterious Dancer / Starman / server issue, and need some clarification on Dancer instances. 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? Thanks, Amelia.
On Thu, 1 Sep 2016 14:32:55 -0700 Amelia Ireland <aireland@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. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.lodgingcompany.com/ OpenPGP Public Key ID: 0x262208A0
On 09/02/2016 12:25 AM, Chad Wallace wrote:
On Thu, 1 Sep 2016 14:32:55 -0700 Amelia Ireland <aireland@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.
participants (3)
-
Amelia Ireland -
Chad Wallace -
Stefan Hornburg (Racke)