| 1 | ############################################################################### | ||
| 2 | # Purpose : No caching backend for Cache::AgainstFile | ||
| 3 | # Author : John Alden | ||
| 4 | # Created : 22 Apr 2005 (based on IFL::FileCache) | ||
| 5 | # CVS : $Id: Null.pm,v 1.5 2005/05/26 15:52:19 simonf Exp $ | ||
| 6 | ############################################################################### | ||
| 7 | |||
| 8 | package Cache::AgainstFile::Null; | ||
| 9 | |||
| 10 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use vars qw($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | $VERSION = sprintf"%d.%03d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/; | |
| 13 | |||
| 14 | 1 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 15 | 1 | my ($class, $loader, $options) = @_; | |
| 16 | 1 | my $self = { | |
| 17 | 'loader' => $loader, | ||
| 18 | 'options' => $options, | ||
| 19 | }; | ||
| 20 | 1 | return bless $self, $class; | |
| 21 | } | ||
| 22 | |||
| 23 | 1 | ▶ | sub get { |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 24 | 1 | my $self = shift; | |
| 25 | 1 | TRACE("Get called on null cache - calling loader"); | |
| 26 | 1 | my $data = $self->{loader}->(@_); | |
| 27 | 1 | return $data; | |
| 28 | } | ||
| 29 | |||
| 30 | 1 | ▶ | sub purge {} |
|
Subroutine
purge: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 31 | 1 | ▶ | sub clear {} |
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 32 | 1 | ▶ | sub count {return 0} |
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 33 | 1 | ▶ | sub size {return 0} |
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 34 | |||
| 35 | # Documented in Cache::AgainstFile::Base | ||
| 36 | 0 | ▶ | sub remove {} |
|
Subroutine
remove: not called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 37 | 0 | ▶ | sub accessed { +{} } |
|
Subroutine
accessed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 38 | 0 | ▶ | sub stale { () } |
|
Subroutine
stale: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 39 | |||
| 40 | #Log::Trace stubs | ||
| 41 | sub TRACE {} | ||
| 42 | sub DUMP {} | ||
| 43 | |||
| 44 | 1 | 1; | |
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | Cache::AgainstFile::Null - backend for Cache::AgainstFile to disable caching | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | my $cache = new Cache::AgainstFile( | ||
| 53 | \&loader, | ||
| 54 | { | ||
| 55 | Method => 'Null', | ||
| 56 | ... | ||
| 57 | } | ||
| 58 | ); | ||
| 59 | |||
| 60 | $data = $cache->get($filename); | ||
| 61 | |||
| 62 | =head1 DESCRIPTION | ||
| 63 | |||
| 64 | This implementation simply calls the cache loader each time get() is called, thus no caching is done. | ||
| 65 | It is useful for testing when you want to quickly disable caching by flipping the Method passed to Cache::AgainstFile. | ||
| 66 | |||
| 67 | =head1 OPTIONS | ||
| 68 | |||
| 69 | There are no additional options for this backend | ||
| 70 | |||
| 71 | =head1 VERSION | ||
| 72 | |||
| 73 | $Revision: 1.5 $ on $Date: 2005/05/26 15:52:19 $ by $Author: simonf $ | ||
| 74 | |||
| 75 | =head1 AUTHOR | ||
| 76 | |||
| 77 | John Alden <cpan _at_ bbc _dot_ co _dot_ uk> | ||
| 78 | |||
| 79 | =head1 COPYRIGHT | ||
| 80 | |||
| 81 | (c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL. | ||
| 82 | |||
| 83 | See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt | ||
| 84 | |||
| 85 | =cut | ||