[Catalyst] advent calendar memcached article misleading or incorrect?

Sam Kaufman samuel.c.kaufman at gmail.com
Wed Dec 22 02:16:25 GMT 2010


Hey,
Sorry about the delay in responding, I was away most of the day.
I wrote the tutorial, and looking at it now it could certainly use
more explanation in regards to what module is doing what.
specifying traits => ['Caching'] in your schema applies
Catalyst::TraitFor::Model::DBIC::Schema::Caching
to your schema,
which sets the default_cursor_class for your schema to
DBIx::Class::Cursor::Cached
and also does this:

    if (ref $self->schema->default_resultset_attributes) {
        $self->schema->default_resultset_attributes->{cache_object} =
            $c->cache;
    } else {
        $self->schema->default_resultset_attributes({
            cache_object => $c->cache
        });
    }
ie sets cache_object ( needed by DBIx::Class::Cursor::Cached )
to  $c->cache, which is provided by Catalyst::Plugin::Cache.
Memcached comes into the picture via the configuration of
Catalyst::Plugin::Cache as you can see in the tutorial.


On Tue, Dec 21, 2010 at 12:01 PM, Tommy Butler <ace at tommybutler.me> wrote:
> On 12/21/2010 10:52 AM, Tommy Butler wrote:
>
> On 12/21/2010 10:43 AM, Bill Moseley wrote:
>
> You seem to have trimmed this link in your email:
>
> http://search.cpan.org/~rkitover/Catalyst-Model-DBIC-Schema-0.48/lib/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm
> <http://search.cpan.org/%7Erkitover/Catalyst-Model-DBIC-Schema-0.48/lib/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm>
>
> Yes!  Sweet Loot, there it is!  Moose magic.
>
> What's more, based on the documentation and the source code for that trait
> module, you don't even need to set your cursor class if you just specify a
> "caching" trait.  The code ||= it for you on line 63 -
> http://cpansearch.perl.org/src/RKITOVER/Catalyst-Model-DBIC-Schema-0.48/lib/Catalyst/TraitFor/Model/DBIC/Schema/Caching.pm
>
> Awesome.
>
> *Thanks for the gentle guidance, Bill.*
>
> --
> Tommy
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>



More information about the Catalyst mailing list