1Catalyst::TraitFor::ModUesle:r:DCCBoaIntCta:rl:iySbscutht:ee:mdTar:Pa:eiCrtalFcohDrio:nc:guM(mo3ed)netla:t:iDoBnIC::Schema::Caching(3)
2
3
4
6 Catalyst::TraitFor::Model::DBIC::Schema::Caching - Query caching
7 support for Catalyst::Model::DBIC::Schema
8
10 __PACKAGE__->config({
11 traits => ['Caching'],
12 connect_info =>
13 ['dbi:mysql:db', 'user', 'pass'],
14 });
15
16 $c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });
17
19 Enable caching support using DBIx::Class::Cursor::Cached and
20 Catalyst::Plugin::Cache.
21
22 In order for this to work, Catalyst::Plugin::Cache must be configured
23 and loaded. A possible configuration would look like this:
24
25 <Plugin::Cache>
26 <backend>
27 class Cache::FastMmap
28 unlink_on_exit 1
29 share_file /tmp/myapp_share
30 </backend>
31 </Plugin::Cache>
32
33 Then in your queries, set the "cache_for" ResultSet attribute to the
34 number of seconds you want the query results to be cached for, eg.:
35
36 $c->model('DB::Table')->search({ foo => 'bar' }, { cache_for => 18000 });
37
39 caching
40 Turn caching on or off, you can use:
41
42 $c->model('DB')->caching(0);
43
45 Catalyst::Model::DBIC::Schema, DBIx::Class, Catalyst::Plugin::Cache,
46 Cache::FastMmap, DBIx::Class::Cursor::Cached
47
49 See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in
50 Catalyst::Model::DBIC::Schema.
51
53 See "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
54
56 This program is free software, you can redistribute it and/or modify it
57 under the same terms as Perl itself.
58
59
60
61perl v5.34.0 Catalys2t0:2:1T-r0a7i-t2F2or::Model::DBIC::Schema::Caching(3)