| 1 | ############################################################################### | ||||||||||
| 2 | # Purpose : Cache Storage Policy Factory. | ||||||||||
| 3 | # Author : Sam Graham | ||||||||||
| 4 | # Created : 23 Jun 2008 | ||||||||||
| 5 | # CVS : $Id: Storage.pm,v 1.9 2010-02-16 12:25:41 illusori Exp $ | ||||||||||
| 6 | ############################################################################### | ||||||||||
| 7 | |||||||||||
| 8 | package Cache::CacheFactory::Storage; | ||||||||||
| 9 | |||||||||||
| 10 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 11 | ▶ | use Class::Factory; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 11 | ▶ | use base qw/Class::Factory/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 11 | $Cache::CacheFactory::Storage::VERSION = '1.10'; | |||||||||
| 18 | |||||||||||
| 19 | sub new | ||||||||||
| 20 | 12 | ▶ | { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 21 | 12 | my ( $this, $type, @params ) = @_; | |||||||||
| 22 | 12 | my ( $class ); | |||||||||
| 23 | |||||||||||
| 24 | 12 | $class = $this->get_factory_class( $type ); | |||||||||
| 25 | 12 | ▶ | return( undef ) unless $class; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 12 | return( $class->new( @params ) ); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 11 | __PACKAGE__->register_factory_type( | |||||||||
| 30 | memory => 'Cache::MemoryCache' ); | ||||||||||
| 31 | 11 | __PACKAGE__->register_factory_type( | |||||||||
| 32 | sharedmemory => 'Cache::SharedMemoryCache' ); | ||||||||||
| 33 | 11 | __PACKAGE__->register_factory_type( | |||||||||
| 34 | file => 'Cache::FileCache' ); | ||||||||||
| 35 | 11 | __PACKAGE__->register_factory_type( | |||||||||
| 36 | null => 'Cache::NullCache' ); | ||||||||||
| 37 | 11 | __PACKAGE__->register_factory_type( | |||||||||
| 38 | fastmemory => 'Cache::FastMemoryCache' ); | ||||||||||
| 39 | |||||||||||
| 40 | 11 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||