Catalyst::TraitFor::Model::DBIC::Schema::Caching(3pm)

Catalyst::TraitFor::Model::DBIC::Schema::Caching3pm

Query caching support for catalyst::model::dbic::schema

Usage

    __PACKAGE__->config({
        traits => ['Caching'],
        connect_info => 
            ['dbi:mysql:db', 'user', 'pass'],
    });
    $c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });

Overview

Enable caching support using DBIx::Class::Cursor::Cached and Catalyst::Plugin::Cache.

In order for this to work, Catalyst::Plugin::Cache must be configured and loaded. A possible configuration would look like this:

  <Plugin::Cache>
    <backend>       
      class Cache::FastMmap
      unlink_on_exit 1
      share_file /tmp/myapp_share
    </backend>
  </Plugin::Cache>

Then in your queries, set the "cache_for" ResultSet attribute to the number of seconds you want the query results to be cached for, eg.:

  $c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });

Config parameters

caching

Turn caching on or off, you can use:

    $c->model('DB')->caching(0);

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 5 times.

  1. 6.0
  2. 7
  3. 8–10
  4. 11
  5. 12
  6. 13

Author

See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in Catalyst::Model::DBIC::Schema.

License

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

From libcatalyst-model-dbic-schema-perl 0.66-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.