NAME

Catalyst::Plugin::CHI - CHI wrap of Catalyst

SYNOPSIS

use Catalyst qw[CHI];

__PACKAGE__->config->{CHI} = {
    driver => 'File',
    cache_root => '/path/to/nowhere'
};

my $data;
unless ( $data = $c->cache->get('data') ) {
    $data = MyApp::Model::Data->retrieve('data');
    $c->cache->set( 'data', $data );
}
$c->response->body($data);

CONFIGURATION

Mostly you need read the CHI. something like follows are accpetable.

__PACKAGE__->config->{CHI} = {
    driver => 'File',
    cache_root => '/path/to/nowhere'
};

__PACKAGE__->config->{CHI} = {
    driver     => 'FastMmap',
    root_dir   => '/path/to/root',
    cache_size => '1k'
};

__PACKAGE__->config->{CHI} = {
    driver  => 'Memcached',
    servers => [ "10.0.0.15:11211", "10.0.0.15:11212" ]
};

__PACKAGE__->config->{CHI} = {
    driver => 'Multilevel',
    subcaches => [
        { driver => 'Memory' },
        {
            driver  => 'Memcached',
            servers => [ "10.0.0.15:11211", "10.0.0.15:11212" ]
        }
    ],
};

METHODS

the $c-cache> are the same as CHI.

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.