Catalyst-Plugin-Cache-Store-FastMmap-0.02/0000755000076500007650000000000010643241442023156 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/0000755000076500007650000000000010643241442023724 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/0000755000076500007650000000000010643241442025510 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/0000755000076500007650000000000010643241442026746 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/Cache/0000755000076500007650000000000010643241442027751 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/Cache/Backend/0000755000076500007650000000000010643241442031300 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm0000644000076500007650000000150510445573720033356 0ustar nothingmuchnothingmuch00000000000000#!/usr/bin/perl package Catalyst::Plugin::Cache::Backend::FastMmap; use base qw/Cache::FastMmap/; use strict; use warnings; # wrap everything in a scalar ref so that we can store plain scalars as well sub get { my ( $self, $key ) = @_; ${ $self->SUPER::get($key) || return }; } sub set { my ( $self, $key, $value ) = @_; $self->SUPER::set( $key => \$value ); } __PACKAGE__; __END__ =pod =head1 NAME Catalyst::Plugin::Cache::Backend::FastMmap - A thin wrapper for L that can handle non refs. =head1 SYNOPSIS use Catalyst::Plugin::Cache::Backend::FastMmap; my $cache_obj = Catalyst::Plugin::Cache::Backend::FastMmap->new; $cache_obj->set( key => [qw/blah blah blah/] ); $cache_obj->set( key => "this_works_too" ); # non references can also be stored =head1 DESCRIPTION =cut Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/Cache/Store/0000755000076500007650000000000010643241442031045 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/lib/Catalyst/Plugin/Cache/Store/FastMmap.pm0000644000076500007650000000462710643241071033122 0ustar nothingmuchnothingmuch00000000000000#!/usr/bin/perl package Catalyst::Plugin::Cache::Store::FastMmap; use strict; use warnings; our $VERSION = "0.02"; use Path::Class (); use File::Spec (); use Catalyst::Utils (); use Catalyst::Plugin::Cache::Backend::FastMmap; sub setup_fastmmap_cache_backend { my ( $app, $name, $config ) = @_; $config->{share_file} ||= File::Spec->catfile( Catalyst::Utils::class2tempdir($app), "cache_$name" ); # make sure it exists Path::Class::file( $config->{share_file} )->parent->mkpath; $app->register_cache_backend( $name => Catalyst::Plugin::Cache::Backend::FastMmap->new( %$config ) ); } __PACKAGE__; __END__ =pod =head1 NAME Catalyst::Plugin::Cache::Store::FastMmap - B - FastMmap cache store for L. =head1 SYNOPSIS # instead of using this plugin, you can now do this: use Catalyst qw/ Cache /; __PACKAGE__->config( cache => { backend => { class => "Cache:FastMmap", share_file => "/path/to/file", cache_size => "16m", }, }); =head1 STATUS This plugin is deprecated because L no longer needs to be wrapped to store plain values. It is still available on the CPAN for backwards compatibility and will still work with newer versions of Cache::FastMmap with a slight performance degredation. =head1 DESCRIPTION This store plugin is a bit of a wrapper for L. While you could normally just configure with backend => { class => "Cache::FastMmap", share_file => ..., } L can't store plain values by default. This module ships with a subclass that will wrap all values in a scalar reference before storing. This store plugin will try to provide a default C as well, that won't clash with other apps. =head1 CONFIGURATION See L for a general overview of cache plugin configuration. This plugin just takes a hash reference in the backend field and passes it on to L. =head1 SEE ALSO L, L. =head1 AUTHOR Yuval Kogman, C =head1 COPYRIGHT & LICENSE Copyright (c) Yuval Kogman, 2006. All rights reserved. This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself, as well as under the terms of the MIT license. =cut Catalyst-Plugin-Cache-Store-FastMmap-0.02/Makefile.PL0000644000076500007650000000116210460476764025146 0ustar nothingmuchnothingmuch00000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.03 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Catalyst::Plugin::Cache::Store::FastMmap', 'VERSION_FROM' => 'lib/Catalyst/Plugin/Cache/Store/FastMmap.pm', 'PREREQ_PM' => { 'Cache::FastMmap' => '0', 'Catalyst' => '5.7', 'Catalyst::Plugin::Cache' => '0.01', 'Path::Class' => '0' }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {} ) ; Catalyst-Plugin-Cache-Store-FastMmap-0.02/MANIFEST0000644000076500007650000000036010643241442024306 0ustar nothingmuchnothingmuch00000000000000lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm lib/Catalyst/Plugin/Cache/Store/FastMmap.pm Makefile.PL MANIFEST This list of files README t/backend.t t/basic.t META.yml Module meta-data (added by MakeMaker) Catalyst-Plugin-Cache-Store-FastMmap-0.02/META.yml0000644000076500007650000000075310643241442024434 0ustar nothingmuchnothingmuch00000000000000--- #YAML:1.0 name: Catalyst-Plugin-Cache-Store-FastMmap version: 0.02 abstract: ~ license: ~ generated_by: ExtUtils::MakeMaker version 6.32 distribution_type: module requires: Cache::FastMmap: 0 Catalyst: 5.7 Catalyst::Plugin::Cache: 0.01 Path::Class: 0 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 Catalyst-Plugin-Cache-Store-FastMmap-0.02/README0000644000076500007650000000347210643241440024042 0ustar nothingmuchnothingmuch00000000000000NAME Catalyst::Plugin::Cache::Store::FastMmap - DEPRECATED - FastMmap cache store for Catalyst::Plugin::Cache. SYNOPSIS # instead of using this plugin, you can now do this: use Catalyst qw/ Cache /; __PACKAGE__->config( cache => { backend => { class => "Cache:FastMmap", share_file => "/path/to/file", cache_size => "16m", }, }); STATUS This plugin is deprecated because Cache::FastMmap no longer needs to be wrapped to store plain values. It is still available on the CPAN for backwards compatibility and will still work with newer versions of Cache::FastMmap with a slight performance degredation. DESCRIPTION This store plugin is a bit of a wrapper for Cache::FastMmap. While you could normally just configure with backend => { class => "Cache::FastMmap", share_file => ..., } Cache::FastMmap can't store plain values by default. This module ships with a subclass that will wrap all values in a scalar reference before storing. This store plugin will try to provide a default "share_file" as well, that won't clash with other apps. CONFIGURATION See "CONFIGURATION" in Catalyst::Plugin::Cache for a general overview of cache plugin configuration. This plugin just takes a hash reference in the backend field and passes it on to Cache::FastMmap. SEE ALSO Catalyst::Plugin::Cache, Cache::FastMmap. AUTHOR Yuval Kogman, "nothingmuch@woobling.org" COPYRIGHT & LICENSE Copyright (c) Yuval Kogman, 2006. All rights reserved. This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself, as well as under the terms of the MIT license. Catalyst-Plugin-Cache-Store-FastMmap-0.02/t/0000755000076500007650000000000010643241442023421 5ustar nothingmuchnothingmuch00000000000000Catalyst-Plugin-Cache-Store-FastMmap-0.02/t/backend.t0000644000076500007650000000136110445602137025200 0ustar nothingmuchnothingmuch00000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { plan skip_all => "This test requires File::Temp" unless eval { require File::Temp }; plan tests => 4; } use Test::Exception; use ok "Catalyst::Plugin::Cache::Backend::FastMmap"; my ( $fh, $name ) = File::Temp::tempfile(); my $cache = Catalyst::Plugin::Cache::Backend::FastMmap->new( share_file => $name, ); lives_ok { $cache->set( key => "non_ref" ); } "you can set non references too"; is( $cache->get("key"), "non_ref", "they are returned properly" ); $cache->set( complex => my $d = { foo => [qw/bar gorch/], baz => "moose" } ); is_deeply( $cache->get("complex"), $d, "storing of refs is unaffected" ); END { close $fh; unlink $name if -e $name; } Catalyst-Plugin-Cache-Store-FastMmap-0.02/t/basic.t0000644000076500007650000000134510445602135024672 0ustar nothingmuchnothingmuch00000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { plan skip_all => "This test requires File::Temp" unless eval { require File::Temp }; plan tests => 3; } use ok "Catalyst::Plugin::Cache::Store::FastMmap"; { package MockApp; use base qw/Catalyst::Plugin::Cache::Store::FastMmap/; our %backends; sub register_cache_backend { my ( $app, $name, $backend ) = @_; $backends{$name} = $backend; } } can_ok( "MockApp", "setup_fastmmap_cache_backend" ); my ( $fh, $name ) = File::Temp::tempfile; MockApp->setup_fastmmap_cache_backend( foo => { share_file => $name } ); isa_ok( $MockApp::backends{foo}, "Cache::FastMmap" ); END { close $fh; unlink $name if -e $name; }