GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PPI::Cache(3) User Contributed Perl Documentation PPI::Cache(3)

PPI::Cache - The PPI Document Caching Layer

  # 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,
  );

"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.

The most common way of using "PPI::Cache" is to provide parameters to the "use" 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 to "use".

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.

The "path" accessor returns the path on the local filesystem that is the root of the cache.

The "readonly" accessor returns true if documents should not be written to the cache.

The "get_document" method checks to see if a Document is stored in the cache and retrieves it if so.

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)

- Finish the basic functionality

- Add support for use PPI::Cache auto-setting $PPI::Document::CACHE

See the support section in the main module.

Adam Kennedy <adamk@cpan.org>

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.

2019-07-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.