Kwiki::Cache - Kwiki Cache Plugin


Kwiki-Cache documentation Contained in the Kwiki-Cache distribution.

Index


Code Index:

NAME

Top

Kwiki::Cache - Kwiki Cache Plugin

SYNOPSIS

Top

DESCRIPTION

Top

AUTHOR

Top

Brian Ingerson <ingy@cpan.org>

COPYRIGHT

Top


Kwiki-Cache documentation Contained in the Kwiki-Cache distribution.

package Kwiki::Cache;
use Kwiki::Plugin -Base;
use Digest::MD5;
our $VERSION = '0.11';

const class_id => 'cache';
const class_title => 'Generic Cache';

sub process {
    my $closure = shift;
    my $cache_name = Digest::MD5::md5_hex(join '!@#$', @_);
    my $path = $self->plugin_directory;
    my $io = io->catfile($path, $cache_name)->assert;
    unless ($io->exists) {
        $io->lock->mode('>>')->open;
        if ($io->empty) {
            $io->print(&$closure);
        }
        $io->close;
    }
    $io->scalar;
}

__DATA__