Catalyst::Plugin::Cache::FastMmap - DEPRECATED FastMmap cache


Catalyst-Plugin-Cache-FastMmap documentation Contained in the Catalyst-Plugin-Cache-FastMmap distribution.

Index


Code Index:

NAME

Top

Catalyst::Plugin::Cache::FastMmap - DEPRECATED FastMmap cache

SYNOPSIS

Top

    use Catalyst qw[Cache::FastMmap];

    MyApp->config(
        cache => {
            storage => '/tmp/cache',
            xpires => 3600,
        },
    );

    my $data;

    unless ( $data = $c->cache->get('data') ) {
        $data = MyApp::Model::Data->retrieve('data');
        $c->cache->set( 'data', $data );
    }

    $c->response->body($data);




DESCRIPTION

Top

This package is part of the Catalyst Cache family. It allows integration of Cache::FastMmap and Catalyst

This module extends the Catalyst application class with a mmap cache.

This module is not recommended for production use, as Cache::FastMmap can segfault and/or unexpectedly throw away your data.

METHODS

Top

setup

Sets up the cache

cache

Returns an instance of Cache::FastMmap

SEE ALSO

Top

Cache::FastMmap, Catalyst.

AUTHOR

Top

Christian Hansen, ch@ngmedia.com

Sebastian Riedel, sri@oook.de

LICENSE

Top

This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.

COPYRIGHT

Top


Catalyst-Plugin-Cache-FastMmap documentation Contained in the Catalyst-Plugin-Cache-FastMmap distribution.

package Catalyst::Plugin::Cache::FastMmap;

use strict;
use warnings;
use MRO::Compat;
use base 'Class::Data::Inheritable';

use Cache::FastMmap;

our $VERSION= '0.9';

__PACKAGE__->mk_classdata('cache');

sub setup {
    my $self = shift;

    my %params = ();

    if ( $self->config->{cache} ) {
        %params = %{ $self->config->{cache} };
    }

    if ( $params{storage} ) {
        $params{share_file} = delete $params{storage};
    }

    if ( $params{expires} ) {
        $params{expire_time} = delete $params{expires};
    }

    $self->cache( Cache::FastMmap->new(%params) );

    return $self->next::method(@_);
}

1;


__END__