Apache-XPP

 view release on metacpan or  search on metacpan

lib/Apache/XPP/Cache/Store/File.pm  view on Meta::CPAN

# Apache::XPP::Cache::Store::File
# ---------------------------------
# $Revision: 1.9 $
# $Date: 2002/01/16 21:06:01 $
# -----------------------------------------------------

=head1 NAME

Apache::XPP::Cache::Store::File - flatfile cache store

=cut

package Apache::XPP::Cache::Store::File;

=head1 SYNOPSIS

...

=head1 REQUIRES

Apache::XPP::Cache::Store
FileHandle
File::stat

=cut

use Carp;
use strict;
use File::stat;
use FileHandle;
use Data::Dumper;
use Apache::XPP::Cache::Store;
use vars qw( @ISA $debug $debuglines );

BEGIN {
	@ISA		= qw( Apache::XPP::Cache::Store );
	$Apache::XPP::Cache::Store::File::REVISION = (qw$Revision: 1.9 $)[-1];
	$Apache::XPP::Cache::Store::File::VERSION = '2.01';
	$debug		= undef;
	$debuglines	= 1;
}

=head1 EXPORTS

Nothing

=head1 DESCRIPTION

Apache::XPP::Cache::Store::File handles the storing of data in flat file form on behalf
of Apache::XPP::Cache.

=head1 METHODS

=over

=item C<new> ( $name, $group, \%instance_data, \$content )

Creates a new File store object. The contents of %instance_data will be placed in the object
as instance data (for Apache request object, etc.).

=cut
sub new {
	my $proto		= shift;
	my $class		= ref($proto) || $proto;
	my $name		= shift;
	my $group		= shift;
	my $instance	= shift;
	
	my $self		= bless( { %{ ref($instance) ? $instance : {} } }, $class );
	my $filename	= $self->location( $name, $group );
	
	$self->name( $name );
	$self->group( $group );
	$self->filename( $filename );
	
	if (my $content = shift) {
		warn "file: setting content ($content) in cache object" . ($debuglines ? '' : "\n") if ($debug >= 2);
		$self->content( $content );
	}
	
	return $self;
} # END constructor new


=item C<location> ( $name, $group )

Returns the fully qualified filename to the store file for the specified name/group pair.
Files are stored by their $name in the directory $group. If the directory $group does
not exist, it will be created with permissions of 0777 (use the C<umask> function to
change these permissions to more desirable ones).



( run in 0.910 second using v1.01-cache-2.11-cpan-5a3173703d6 )