1package Catalyst::Plugin::Cache::FastMmap; 2 3use strict; 4use warnings; 5use MRO::Compat; 6use base 'Class::Data::Inheritable'; 7 8use Cache::FastMmap; 9 10our $VERSION= '0.9'; 11 12__PACKAGE__->mk_classdata('cache'); 13 14sub setup { 15 my $self = shift; 16 17 my %params = (); 18 19 if ( $self->config->{cache} ) { 20 %params = %{ $self->config->{cache} }; 21 } 22 23 if ( $params{storage} ) { 24 $params{share_file} = delete $params{storage}; 25 } 26 27 if ( $params{expires} ) { 28 $params{expire_time} = delete $params{expires}; 29 } 30 31 $self->cache( Cache::FastMmap->new(%params) ); 32 33 return $self->next::method(@_); 34} 35 361; 37 38 39__END__ 40 41=head1 NAME 42 43Catalyst::Plugin::Cache::FastMmap - DEPRECATED FastMmap cache 44 45=head1 SYNOPSIS 46 47 use Catalyst qw[Cache::FastMmap]; 48 49 MyApp->config( 50 cache => { 51 storage => '/tmp/cache', 52 xpires => 3600, 53 }, 54 ); 55 56 my $data; 57 58 unless ( $data = $c->cache->get('data') ) { 59 $data = MyApp::Model::Data->retrieve('data'); 60 $c->cache->set( 'data', $data ); 61 } 62 63 $c->response->body($data); 64 65 66=head1 DESCRIPTION 67 68This package is part of the Catalyst Cache family. It allows 69integration of L<Cache::FastMmap> and L<Catalyst> 70 71This module extends the Catalyst application class with a C<mmap> cache. 72 73This module is not recommended for production use, as L<Cache::FastMmap> can 74segfault and/or unexpectedly throw away your data. 75 76=head1 METHODS 77 78=over 79 80=item setup 81 82Sets up the cache 83 84=item cache 85 86Returns an instance of C<Cache::FastMmap> 87 88=back 89 90=head1 SEE ALSO 91 92L<Cache::FastMmap>, L<Catalyst>. 93 94=head1 AUTHOR 95 96Christian Hansen, C<ch@ngmedia.com> 97 98Sebastian Riedel, C<sri@oook.de> 99 100=head1 LICENSE 101 102This library is free software . You can redistribute it and/or modify it under 103the same terms as perl itself. 104 105=head1 COPYRIGHT 106 107Copyright (c) 2005-2011, the above mentioned AUTHORs. 108 109=cut 110