[Catalyst] Caching an expensive "global" calculation?

Dr. Jennifer Nussbaum bg271828 at yahoo.com
Wed Apr 12 10:44:33 GMT 2017


Hi,
This may not be strictly Catalyst-related, but I'd be grateful for any help - I dont know much abouteither caching or making things available throughout an app :-(
I have an app that uses a number of different outside configuration files; which one it uses depends onseveral factors, and it will be the same one per request cycle. Parsing each file is an expensivecalculation. Originally I read it at the beginning of the cycle and passed the resulting variable around,but my models are now so complicated that this has gotten tedious, and I wanted to do somethinglike have a utility method MyApp::Utilities->get_outside_config($id) that any model can call when itneeds to. However, I dont want to have to recalculate it in every get_outside_config call.
Whats the best way of handling this? The config is used very often, and could be regarded as global,but also most of my models are non-Catalyst ones that are glued in, so $c isnt available to them. Theconfig files dont change often.
Thanks.
Jen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20170412/02e28aa0/attachment.htm>


More information about the Catalyst mailing list