-
-
19 Jul 2022 21:50:31 UTC
- Distribution: PPI
- Module version: 1.276
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (966 / 0 / 0)
- Kwalitee
Bus factor: 2- 85.12% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (239.45KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 44 contributors-
Adam Kennedy
-
Arnout Pierre
-
bowtie
-
brian d foy
-
Chas. J. Owens IV
-
Chris Capaci
-
Chris Dolan
-
Christian Walde
-
Colin Newell
-
Damyan Ivanov
-
Dan Book
-
David Steinbrunner
-
Edmund Adjei
-
Elliot Shank
-
Gabor Szabo
-
Graham Knop
-
Graham Ollis
-
Guillaume Aubert
-
James E Keenan
-
Joel Maslak
-
Julian Fondren
-
Karen Etheridge
-
Kent Fredric
-
Lance Wicks
-
Matt Church
-
Matthew Horsfall
-
Mike O'Regan
-
Milos Kukla
-
Mohammad S Anwar
-
nanto_vi
-
Olaf Alders
-
Olivier Mengué
-
Philippe Bruhat (BooK)
-
Randy Lauen
-
Reini Urban
-
reneeb
-
Shmuel Fomberg
-
Steffen Müller
-
Szymon Nieznański
-
Takumi Akiyama
-
Thomas Sibley
-
Tom Wyant
-
Van de Bugger
-
Will Braswell
- Dependencies
- Carp
- Clone
- Digest::MD5
- Exporter
- File::Path
- File::Spec
- List::Util
- Params::Util
- Scalar::Util
- Storable
- Task::Weaken
- constant
- if
- overload
- strict
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
PPI::Cache - The PPI Document Caching Layer
SYNOPSIS
# Set the cache use PPI::Cache path => '/var/cache/ppi-cache'; # Manually create a cache my $Cache = PPI::Cache->new( path => '/var/cache/perl/class-PPI', readonly => 1, );
DESCRIPTION
PPI::Cache
provides the default caching functionality for PPI.It integrates automatically with PPI itself. Once enabled, any attempt to load a document from the filesystem will be cached via cache.
Please note that creating a PPI::Document from raw source or something other object will not be cached.
Using PPI::Cache
The most common way of using
PPI::Cache
is to provide parameters to theuse
statement at the beginning of your program.# Load the class but do not set a cache use PPI::Cache; # Use a fairly normal cache location use PPI::Cache path => '/var/cache/ppi-cache';
Any of the arguments that can be provided to the
new
constructor can also be provided touse
.METHODS
new param => $value, ...
The
new
constructor creates a new standalone cache object.It takes a number of parameters to control the cache.
- path
-
The
path
param sets the base directory for the cache. It must already exist, and must be writable. - readonly
-
The
readonly
param is a true/false flag that allows the use of an existing cache by a less-privileged user (such as the web user).Existing documents will be retrieved from the cache, but new documents will not be written to it.
Returns a new
PPI::Cache
object, or dies on error.path
The
path
accessor returns the path on the local filesystem that is the root of the cache.readonly
The
readonly
accessor returns true if documents should not be written to the cache.get_document $md5sum | \$source
The
get_document
method checks to see if a Document is stored in the cache and retrieves it if so.store_document $Document
The
store_document
method takes a PPI::Document as argument and explicitly adds it to the cache.Returns true if saved, or
undef
(or dies) on error.FIXME (make this return either one or the other, not both)
TO DO
- Finish the basic functionality
- Add support for use PPI::Cache auto-setting $PPI::Document::CACHE
SUPPORT
See the support section in the main module.
AUTHOR
Adam Kennedy <adamk@cpan.org>
COPYRIGHT
Copyright 2005 - 2011 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
Module Install Instructions
To install PPI, copy and paste the appropriate command in to your terminal.
cpanm PPI
perl -MCPAN -e shell install PPI
For more information on module installation, please visit the detailed CPAN module installation guide.