File: Entry.pm

package info (click to toggle)
librose-db-perl 0.769-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 764 kB
  • sloc: perl: 11,200; makefile: 9
file content (101 lines) | stat: -rw-r--r-- 2,290 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package Rose::DB::Cache::Entry;

use strict;

use base 'Rose::Object';

our $VERSION = '0.736';

use Rose::Object::MakeMethods::Generic
(
  'scalar'  => 
  [
    'db',
    'key',
  ],

  'boolean' => 
  [
    'prepared',
    'created_during_apache_startup',
  ]
);

*is_prepared = \&prepared;

1;

__END__

=head1 NAME

Rose::DB::Cache::Entry - A cache entry for use with Rose::DB::Cache objects.

=head1 SYNOPSIS

  package My::DB::Cache::Entry;

  use base 'Rose::DB::Cache::Entry';
  ...

  package My::DB::Cache;

  use base 'Rose::DB::Cache';

  use My::DB::Cache::Entry;

  __PACKAGE__->entry_class('My::DB::Cache::Entry');
  ...

=head1 DESCRIPTION

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.

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.


=head1 CONSTRUCTORS

=over 4

=item B<new PARAMS>

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.

=back

=head1 OBJECT METHODS

=over 4

=item B<created_during_apache_startup [BOOL]>

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.

=item B<db [DB]>

Get or set the L<Rose::DB>-derived object stored in this cache entry.

=item B<key [KEY]>

Get or set the cache key for this entry.

=item B<prepared [BOOL]>

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.

=item B<is_prepared>

Returns true if L<prepared|/prepared> is true, false otherwise.

=back

=head1 AUTHOR

John C. Siracusa (siracusa@gmail.com)

=head1 LICENSE

Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This program is
free software; you can redistribute it and/or modify it under the same terms
as Perl itself.