in reply to Re^2: Catalyst, Accessing Cache plugins from Models
in thread Catalyst, Accessing Cache plugins from Models

Ok, next step look inside :) https://metacpan.org/source/ILMARI/Catalyst-Model-DBIC-Schema-0.62/lib/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm

What you see is getting a reference to the controller object, and getting a reference from the controller to the cache object, and storing the reference to the cache object

use namespace::autoclean; use Moose::Role; before ACCEPT_CONTEXT => sub { my ($self, $c) = @_; ... $self->schema->default_resultset_attributes({ cache_object => $c->cache }); }

So Your Mother is onto something, all I can say is EEEEW

Replies are listed 'Best First'.
Re^4: Catalyst, Accessing Cache plugins from Models
by djzort (Sexton) on Mar 25, 2014 at 03:16 UTC

    Yeah I had seen that but was hoping there was a "proper" way. Pity.

    IMO caching should be available in M, V and C - but that could be a lively debate for another time.

      Well, it is available. You cache output. This is how some sites like github make pretty intensive stuff quite speedy.

      You can also propagate the context around with the modules I suggested and share the controller’s cache.

      You can also have a memcached or whatever available as a plain extra-app class—CHI is a great choice for this—and instantiate an access object in your M and C and if you really insist, in the V too.

      Starts to sound a lot like PHP at this point. :|