File Coverage

blib/lib/Rose/DB/Cache/Entry.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Rose::DB::Cache::Entry;
2              
3 16     16   119 use strict;
  16         38  
  16         558  
4              
5 16     16   89 use base 'Rose::Object';
  16         41  
  16         2455  
6              
7             our $VERSION = '0.736';
8              
9             use Rose::Object::MakeMethods::Generic
10             (
11 16         201 'scalar' =>
12             [
13             'db',
14             'key',
15             ],
16              
17             'boolean' =>
18             [
19             'prepared',
20             'created_during_apache_startup',
21             ]
22 16     16   9500 );
  16         95134  
23              
24             *is_prepared = \&prepared;
25              
26             1;
27              
28             __END__
29              
30             =head1 NAME
31              
32             Rose::DB::Cache::Entry - A cache entry for use with Rose::DB::Cache objects.
33              
34             =head1 SYNOPSIS
35              
36             package My::DB::Cache::Entry;
37              
38             use base 'Rose::DB::Cache::Entry';
39             ...
40              
41             package My::DB::Cache;
42              
43             use base 'Rose::DB::Cache';
44              
45             use My::DB::Cache::Entry;
46              
47             __PACKAGE__->entry_class('My::DB::Cache::Entry');
48             ...
49              
50             =head1 DESCRIPTION
51              
52             L<Rose::DB::Cache::Entry> provides both an API and a default implementation of a cache entry for use with L<Rose::DB::Cache> objects. A L<Rose::DB::Cache>-derived class L<uses|Rose::DB::Cache/entry_class> L<Rose::DB::Cache::Entry>-derived objects to store cache entries.
53              
54             The default implementation includes attributes for storing the cache key, the cached L<Rose::DB>-derived object itself, and some boolean flags. Subclasses can add new attributes as desired.
55              
56              
57             =head1 CONSTRUCTORS
58              
59             =over 4
60              
61             =item B<new PARAMS>
62              
63             Constructs a new L<Rose::DB::Cache::Entry> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name.
64              
65             =back
66              
67             =head1 OBJECT METHODS
68              
69             =over 4
70              
71             =item B<created_during_apache_startup [BOOL]>
72              
73             Get or set a boolean value indicating whether or not the L<db|/db> object this cache entry contains was created while the apache server was starting up.
74              
75             =item B<db [DB]>
76              
77             Get or set the L<Rose::DB>-derived object stored in this cache entry.
78              
79             =item B<key [KEY]>
80              
81             Get or set the cache key for this entry.
82              
83             =item B<prepared [BOOL]>
84              
85             Get or set a boolean value indicating whether or not a cache entry is "prepared." The interpretation of this flag is up to the L<Rose::DB::Cache>-derived class that L<uses|Rose::DB/entry_class> this entry class.
86              
87             =item B<is_prepared>
88              
89             Returns true if L<prepared|/prepared> is true, false otherwise.
90              
91             =back
92              
93             =head1 AUTHOR
94              
95             John C. Siracusa (siracusa@gmail.com)
96              
97             =head1 LICENSE
98              
99             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is
100             free software; you can redistribute it and/or modify it under the same terms
101             as Perl itself.