Cache::CacheFactory::Storage - Factory class for storage policies for Cache::CacheFactory.


Cache-CacheFactory documentation Contained in the Cache-CacheFactory distribution.

Index


Code Index:

NAME

Top

Cache::CacheFactory::Storage - Factory class for storage policies for Cache::CacheFactory.

DESCRIPTION

Top

Cache::CacheFactory::Storage is a class factory for storage policies used by Cache::CacheFactory.

You will only need to know about this module if you're writing your own storage policy modules, documented in "WRITING NEW POLICIES" in Cache::CacheFactory.

METHODS

Top

$policy = Cache::CacheFactory::Storage->new( $type, @param );

Construct an storage policy of the specified type, supplying @param to the constructor of the policy object.

SEE ALSO

Top

Cache::CacheFactory, Class::Factory

AUTHORS

Top

Original author: Sam Graham <libcache-cachefactory-perl BLAHBLAH illusori.co.uk>

Last author: $Author: illusori $

COPYRIGHT

Top


Cache-CacheFactory documentation Contained in the Cache-CacheFactory distribution.

###############################################################################
# Purpose : Cache Storage Policy Factory.
# Author  : Sam Graham
# Created : 23 Jun 2008
# CVS     : $Id: Storage.pm,v 1.9 2010-02-16 12:25:41 illusori Exp $
###############################################################################

package Cache::CacheFactory::Storage;

use warnings;
use strict;

use Class::Factory;

use base qw/Class::Factory/;

$Cache::CacheFactory::Storage::VERSION = '1.10';

sub new
{
    my ( $this, $type, @params ) = @_;
    my ( $class );

    $class = $this->get_factory_class( $type );
    return( undef ) unless $class;
    return( $class->new( @params ) );
}

__PACKAGE__->register_factory_type(
    memory       => 'Cache::MemoryCache' );
__PACKAGE__->register_factory_type(
    sharedmemory => 'Cache::SharedMemoryCache' );
__PACKAGE__->register_factory_type(
    file         => 'Cache::FileCache' );
__PACKAGE__->register_factory_type(
    null         => 'Cache::NullCache' );
__PACKAGE__->register_factory_type(
    fastmemory   => 'Cache::FastMemoryCache' );

1;

__END__