1DBIx::Class::Cursor::CaUcsheerd(C3o)ntributed Perl DocumDeBnItxa:t:iColnass::Cursor::Cached(3)
2
3
4
6 DBIx::Class::Cursor::Cached - cursor class with built-in caching
7 support
8
10 my $schema = SchemaClass->connect(
11 $dsn, $user, $pass, { cursor_class => 'DBIx::Class::Cursor::Cached' }
12 );
13
14 $schema->default_resultset_attributes({
15 cache_object => Cache::FileCache->new({ namespace => 'SchemaClass' }),
16 });
17
18 my $rs = $schema->resultset('CD')->search(undef, { cache_for => 300 });
19
20 my @cds = $rs->all; # fills cache
21
22 $rs = $schema->resultset('CD')->search(undef, { cache_for => 300 });
23 # refresh resultset
24
25 @cds = $rs->all; # uses cache, no SQL run
26
27 $rs->cursor->clear_cache; # deletes data from cache
28
29 @cds = $rs->all; # refills cache
30
32 Matt S Trout <mst@shadowcat.co.uk> http://www.shadowcat.co.uk/
33
34 Initial development sponsored by and (c) Takkle, Inc. 2007
35
37 This library is free software under the same license as perl itself
38
39
40
41perl v5.32.0 2020-07-28 DBIx::Class::Cursor::Cached(3)