Permalink
Browse files

add cache for rss feed

  • Loading branch information...
1 parent 64260d5 commit 8338b31ac39f418683a5a2f27b063632fc658b71 @yanick committed Dec 20, 2010
Showing with 15 additions and 1 deletion.
  1. +3 −0 Makefile.PL
  2. +10 −1 lib/Galuga.pm
  3. +2 −0 lib/Galuga/Controller/Root.pm
View
@@ -17,6 +17,9 @@ requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
requires 'CatalystX::Component::Traits' => '0.16';
+requires 'Catalyst::Plugin::PageCache';
+requires 'Catalyst::Plugin::Cache';
+requires 'Cache::FileCache';
requires 'Moose';
requires 'namespace::autoclean';
requires 'Config::General'; # This should reflect the config file format you've chosen
View
@@ -15,11 +15,13 @@ use Catalyst::Runtime 5.80;
use Catalyst qw/
ConfigLoader
Static::Simple
+ Cache
+ PageCache
/;
extends 'Catalyst';
-our $VERSION = '0.3.0';
+our $VERSION = '0.4.0';
$VERSION = eval $VERSION;
# Configure the application.
@@ -39,6 +41,13 @@ __PACKAGE__->config(
static => {
ignore_dirs => [ 'css' ],
},
+ 'Plugin::Cache' => {
+ backend => {
+ class => 'Cache::FileCache',
+ } },
+ 'Plugin::PageCache' => {
+ set_http_headers => 1
+ },
);
# Start the application
@@ -114,6 +114,8 @@ sub feed :Path('atom.xml') :Args(0) {
$c->res->content_type( 'application/atom+xml' );
$c->res->body( $feed->as_string );
+
+ $c->cache_page( 60 * 60 );
}
=head2 default

0 comments on commit 8338b31

Please sign in to comment.