logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Catalyst::TraitFor::Model::DBIC::Schema::Caching - Query caching support for

Author

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

Config Parameters

caching
       Turn caching on or off, you can use:

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

Description

       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 });

License

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

perl v5.36.0                                       2023-10-26             Catalyst::Trait...Schema::Caching(3pm)

Name

       Catalyst::TraitFor::Model::DBIC::Schema::Caching - Query caching support for
       Catalyst::Model::DBIC::Schema

See Also

       Catalyst::Model::DBIC::Schema, DBIx::Class, Catalyst::Plugin::Cache, Cache::FastMmap,
       DBIx::Class::Cursor::Cached

Synopsis

           __PACKAGE__->config({
               traits => ['Caching'],
               connect_info =>
                   ['dbi:mysql:db', 'user', 'pass'],
           });

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

See Also