|
This is the full configuration for my model, which includes heavy
caching (it's a readonly access to a data warehouse which gets updated
once a day): Model::MyDB: traits: - Caching - SchemaProxy default_resultset_attributes: cache_for: 3600 # cache results for one our connect_info: dsn: 'dbd:mysql:host=1.2.3.4;database=test' user: test password: test The 'Caching' trait is what allows you to use the DBIx::Class::Cursor::Cached caching. The SchemaProxy trait allows you to specify the default_resultset_attributes once and for all resultsets in this model, without having to specify it in every place you use a RS from this model. And after that you also have to configure the caching backend: Plugin::Cache: backend: class: 'Cache::FastMmap' unlink_on_exit: 1 share_file: /tmp/datafile.cache cache_size: 32m With this configuration I didn't have to touch a single line where queries were being executed. Just added these lines to my Catalyst configuration (after installing the correspoding modules, of course). Modules that I had to install from CPAN: Catalyst::Plugin::Cache Cache::FastMmap Catalyst::TraitFor::Model::DBIC::Schema::Caching Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy DBIx::Class::Cursor::Cached (I think this one is brought by Caching trait as a dependency). Regards J.
El 03/07/11 19:53, Eden Cardim escribió: "Alex" == Alex Povolotsky <[email protected]> writes: |
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]

