line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################### |
2
|
|
|
|
|
|
|
# Purpose : Cache Expiry Policy Factory. |
3
|
|
|
|
|
|
|
# Author : Sam Graham |
4
|
|
|
|
|
|
|
# Created : 23 Jun 2008 |
5
|
|
|
|
|
|
|
# CVS : $Id: Expiry.pm,v 1.8 2010-02-16 12:25:41 illusori Exp $ |
6
|
|
|
|
|
|
|
############################################################################### |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Cache::CacheFactory::Expiry; |
9
|
|
|
|
|
|
|
|
10
|
10
|
|
|
10
|
|
58
|
use warnings; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
315
|
|
11
|
10
|
|
|
10
|
|
55
|
use strict; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
347
|
|
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
48
|
use Class::Factory; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
206
|
|
14
|
|
|
|
|
|
|
|
15
|
10
|
|
|
10
|
|
49
|
use base qw/Class::Factory/; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
1987
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$Cache::CacheFactory::Expiry::VERSION = '1.10'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new |
20
|
|
|
|
|
|
|
{ |
21
|
5
|
|
|
5
|
1
|
17
|
my ( $this, $type, @params ) = @_; |
22
|
5
|
|
|
|
|
7
|
my ( $class ); |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
38
|
$class = $this->get_factory_class( $type ); |
25
|
5
|
50
|
|
|
|
99
|
return( undef ) unless $class; |
26
|
5
|
|
|
|
|
47
|
return( $class->new( @params ) ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( |
30
|
|
|
|
|
|
|
forever => 'Cache::CacheFactory::Expiry::Base' ); |
31
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( |
32
|
|
|
|
|
|
|
time => 'Cache::CacheFactory::Expiry::Time' ); |
33
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( |
34
|
|
|
|
|
|
|
size => 'Cache::CacheFactory::Expiry::Size' ); |
35
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( |
36
|
|
|
|
|
|
|
lastmodified => 'Cache::CacheFactory::Expiry::LastModified' ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |