[Catalyst] Caching problem?

Brandon Black blblack at gmail.com
Wed Jan 11 22:13:58 CET 2006


On 1/11/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> So long as you do it by setting MyApp->response_class and not by messing
> with Catalyst::Response directly :)
>

You mean like this? :)

---------------------------------------------------------------------
package Catalyst::Plugin::Response::NoCache;

use strict;
use warnings;

our $VERSION = '0.01';

use POSIX ();
use Catalyst::Response;

{
    package Catalyst::Response;

    sub no_cache {
        my $self = shift;

        $self->header( 'Expires' => 'Sat, 26 Jul 1997 05:00:00 GMT' );
        $self->header( 'Last-Modified' => POSIX::strftime('%a, %d %b
%Y %H:%M:%S GMT', gmtime) );
        $self->header( 'Pragma' => 'no-cache' );
        $self->header( 'Cache-Control' => 'no-store, no-cache,
must-revalidate, post-check=0, pre-check=0, max-age=0' );

        1;
    }
}

1;

--------------------------------------------------

What's the "right" way to do it with response_class? Subclass
Catalyst::Request and set response_class to that from withint the
plugin somehow?

-- Brandon



More information about the Catalyst mailing list