The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gantry::Plugins::PageCache - A plugin for caching application pages

SYNOPSIS

In Apache Perl startup or app.cgi or app.server:

    <Perl>
        # ...
        use MyApp qw{ 
            -Engine=CGI 
            -TemplateEngine=TT 
            Cache::FastMap # or Cache::Storable 
            PageCache 
        };
                
    </Perl>

DESCRIPTION

The purpose of the plugin is to store and retrieve cached application pages.

Note that you must include PageCache in the list of imported items when you use your base app module.

CONFIGURATION

The following items can be set by configuration. If any of the following match then caching will be enabled.

** At least one cache criteria must be set.

Cache pages based on a certain action.

 $self->gantry_pagecache_action( 'do_edit,do_delete,do_view' );

Cache pages based on the mime types.

 $self->gantry_pagecache_mime_type( 'text/html,text/rss' );

Cache every page that is produced by a controller.

 $self->gantry_pagecache_location( '/controller1' );

Cache distinct pages produced by a controller.

 $self->gantry_pagecache_uri( '/controller1/rss' );

METHODS

get_callbacks

For use by Gantry.pm. Registers the callbacks needed for cache management during the PerlHandler Apache phase or its moral equivalent.

gantry_pagecache_store

Callback to store the cached page.

gantry_pagecache_retrieve

Callback to retrieve the cached page.

gantry_pagecache_location

Location(s) to cache

gantry_pagecache_action

Action(s) to cache

gantry_pagecache_crud

Boolean accessor for whether to attempt caching of CRUD behaviors.

gantry_pagecache_mime_type

MIME type(s) to cache

gantry_pagecache_uri

URI(s) to cache

gantry_pagecache

Holds the cache key if caching is enabled

TODO

Add a caching scheme where you can use an SQL::Abstract like syntax.

 {
    -and => {
        mime_type = [
            'text/html',
            'text/rss',
        ],
        location = [
            '/controller1',
            '/controller2',
        ],
    },
    -or => {
        mime_type => { '!=', 'img/gif' } 
    }
 }

SEE ALSO

    Gantry

AUTHOR

Tim Keefer <tim@timkeefer.com>

COPYRIGHT AND LICENSE

Copyright (C) 2007 Tim Keefer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.