[Catalyst] Store something in the stash at startup

Tomas Doran bobtfish at bobtfish.net
Tue Aug 17 11:23:41 GMT 2010


On 17 Aug 2010, at 06:27, Octavian Rasnita wrote:
>
> I load and store this object in the stash on each request in the  
> Root::auto : Private method with:
>
> $c->stash(menu => $c->model('Menu'));
>
> But this would re-create the menu object on each request, and this  
> takes time.

No, it wouldn't. The adaptor you showed has a lifetime of the  
application, and so it won't be recreated each request.

Also, even if you were creating an object every request (which you  
aren't), if you're worrying about this without numbers, then this is  
premature opimisation.

Cheers
t0m





More information about the Catalyst mailing list