[Dbix-class] Question about relationship result caching
Mike Henson
mdh2112 at speakeasy.net
Sun Jun 17 06:22:45 GMT 2007
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
--
More information about the Dbix-class
mailing list