[Catalyst-commits] r13987 - in Catalyst-Plugin-Cache-Store-FastMmap/trunk: . lib/Catalyst/Plugin/Cache/Backend lib/Catalyst/Plugin/Cache/Store

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Mar 22 08:18:01 GMT 2011


Author: t0m
Date: 2011-03-22 08:18:01 +0000 (Tue, 22 Mar 2011)
New Revision: 13987

Modified:
   Catalyst-Plugin-Cache-Store-FastMmap/trunk/Changes
   Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm
   Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Store/FastMmap.pm
Log:
New version

Modified: Catalyst-Plugin-Cache-Store-FastMmap/trunk/Changes
===================================================================
--- Catalyst-Plugin-Cache-Store-FastMmap/trunk/Changes	2011-03-20 00:52:55 UTC (rev 13986)
+++ Catalyst-Plugin-Cache-Store-FastMmap/trunk/Changes	2011-03-22 08:18:01 UTC (rev 13987)
@@ -1,5 +1,11 @@
 Revision history for Perl extension Catalyst::Plugin::Cache::Store::FastMmap.
 
+0.04  2011-03-22
+    - Clean up documentation & license info
+    - Additional deprecation warnings
+    - Newer Module::Install
+    - RT#66769 - support expiry when setting cache keys.
+
 0.03  2007-09-14
     - Switch to Module::Install
 

Modified: Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm
===================================================================
--- Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm	2011-03-20 00:52:55 UTC (rev 13986)
+++ Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Backend/FastMmap.pm	2011-03-22 08:18:01 UTC (rev 13987)
@@ -14,8 +14,8 @@
 }
 
 sub set {
-    my ( $self, $key, $value ) = @_;
-    $self->SUPER::set( $key => \$value );
+    my ( $self, $key, $value, $expiry ) = @_;
+    $self->SUPER::set( $key => \$value, ($expiry ? $expiry : ()) );
 }
 
 __PACKAGE__;
@@ -38,15 +38,41 @@
     $cache_obj->set( key => [qw/blah blah blah/] );
 
     $cache_obj->set( key => "this_works_too" ); # non references can also be stored
+    
+    # or, more usually:
+    
+    use Catalyst qw/
+        Cache
+    /;
 
+    __PACKAGE__->config( cache => {
+        backend => {
+            class => "Cache:FastMmap",
+            share_file => "/path/to/file",
+            cache_size => "16m",
+        },
+    });
+
 =head1 DESCRIPTION
 
+This is a L<Cache::FastMmap> backend for L<Catalyst::Plugin::Cache>. Note that L<Cache::FastMmap>
+is not recommended for production use due to the fact it has been known to segfault
+unexpectedly, and the expiry policy can work unexpectedly.
+
 =head1 METHODS
 
-=head2 get
+=head2 get ($key)
 
-=head2 set
+Get an item from the cache by key
 
+=head2 set ($key, $value, [$expiry])
+
+Store an item in the cache.
+
+=head1 AUTHOR, COPYRIGHT & LICENSE
+
+See L<Catalyst::Plugin::Cache::Store::FastMmap>.
+
 =cut
 
 

Modified: Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Store/FastMmap.pm
===================================================================
--- Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Store/FastMmap.pm	2011-03-20 00:52:55 UTC (rev 13986)
+++ Catalyst-Plugin-Cache-Store-FastMmap/trunk/lib/Catalyst/Plugin/Cache/Store/FastMmap.pm	2011-03-22 08:18:01 UTC (rev 13987)
@@ -5,7 +5,7 @@
 use strict;
 use warnings;
 
-our $VERSION = "0.02";
+our $VERSION = "0.04";
 
 use Path::Class     ();
 use File::Spec      ();
@@ -18,7 +18,7 @@
     $config->{share_file} ||= File::Spec->catfile( Catalyst::Utils::class2tempdir($app), "cache_$name" );
 
     # make sure it exists
-    Path::Class::file( $config->{share_file} )->parent->mkpath; 
+    Path::Class::file( $config->{share_file} )->parent->mkpath;
 
     $app->register_cache_backend(
         $name => Catalyst::Plugin::Cache::Backend::FastMmap->new( %$config )
@@ -96,9 +96,13 @@
 
 Yuval Kogman, C<nothingmuch at woobling.org>
 
+=head1 CONTRIBUTORS
+
+Tomas Doran, C<bobtfish at bobtfish.net>.
+
 =head1 COPYRIGHT & LICENSE
 
-Copyright (c) Yuval Kogman, 2006. All rights reserved.
+Copyright (c) The above AUTHOR and CONTRIBUTORs, 2006-2011. Some 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.




More information about the Catalyst-commits mailing list