Hello,

If I call a relationship accessor are the resulting objects it produces
cached or is the query sent to the db every time?

Example:

=====
# Very basic relationship snippets
package Example::Shelf;
__PACKAGE__->table('shelf');
__PACKAGE__->belongs_to( 'books' => 'Example::Books' );

=====

#!/usr/bin/perl -w

.. connection stuff ..

my $shelf = $schema->resultset('Shelf');

my @books = $shelf->books;  # Does the query to get these objects

my @other_books = $shelf->books;  # Does the query happen again?


I looked in the source for a way to set a 'cache'=>1 attribute on
relationships and inflated columns, but it doesn't seem to be in the
list from DBIx::Class::Relationship::Base.

Thanks,
Mike

-- 


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to