package Catalyst::Model::DBIC::Schema::Role::Caching;
use Moose::Role;
-use Carp::Clan '^Catalyst::Model::DBIC::Schema';
+use Carp::Clan '^Catalyst::Model::DBIC::Schema::';
use namespace::clean -except => 'meta';
=head1 NAME
Catalyst::Model::DBIC::Schema::Role::Caching - Query caching support for
-DBIx::Class
+Catalyst::Model::DBIC::Schema
=head1 SYNOPSIS
=head1 CONFIG PARAMETERS
-=over 4
-
-=item caching
+=head2 caching
Turn caching on or off, you can use:
to disable caching at runtime.
-=back
-
=cut
has 'caching' => (is => 'rw', isa => 'Int', default => 1);
=head1 METHODS
-=over 4
-
-=item _reset_cursor_class
+=head2 _reset_cursor_class
Reset the cursor class to L<DBIx::Class::Storage::DBI::Cursor> if it's set to
-L<DBIx::Class::Cursor::Cached>.
+L<DBIx::Class::Cursor::Cached>, if possible.
=cut
my $self = shift;
if ($self->connect_info->{cursor_class} eq 'DBIx::Class::Cursor::Cached') {
- $self->storage->cursor_class('DBIx::Class::Storage::DBI::Cursor');
+ $self->storage->cursor_class('DBIx::Class::Storage::DBI::Cursor')
+ if $self->storage->can('cursor_class');
}
1;
}
-=back
-
=head1 SEE ALSO
L<Catalyst::Model::DBIC::Schema>, L<DBIx::Class>, L<Catalyst::Plugin::Cache>,