Buy a  conference ticketBook a Perl 6 class

Procrastinate with DBIx::LazyCache

Jeffrey Goff — 45 minutes 🐪

Do you experience feelings of dread or fear when you update database tables? Have you ever wanted to tell a DBIC column “Ah, fuggedaboudit” and populate it later? Then you need DBIx::LazyCache, at a CPAN mirror near you. Consolidate your caching and business logic in one easy-to-use DBIx::Model.

DBIx::LazyCache is a caching and lazy evaluation engine sitting on top of DBIx::Class. It supplies a framework which lets you add DBIx::Class relationships like:

* Make Product.retail_price “read-only”
* Evaluate Product.retail_price only when you’re ready to display it.
* Change Product.retail_price when Product.wholesale_price or Market.rate changes.

So instead of checking every update() and view to see where you forgot to update the retail_price, you just have to read MyApp::Model::Result::Product to see what should change and when. And instead of implementing business logic all over your Dancer2 app, you just set Market.rate to NULL and let the model take care of the rest. Should you be new to the system, do the calculation yourself and go to update Product.retail_price, the model itself informs you of your mistake and suggests that you update Product.wholesale_price or Market.price.

Caching, lazy evaluation and business logic, all in one easy-to-use module suite. DBIx::LazyCache. Coming to a CPAN mirror near you.



Talk tags
Perl, Perl 5, DBIx::Class, Database, Caching, JIT, Lazy, Moose
Perl versions
🐪 Perl 5
Target audience
Any
Category
Perl 5 programming
Talk duration
45 minutes
Talk status
accepted