@@ -16,7 +16,7 @@ my $builder = Test::Run::Builder->new(
{
'DB_File' => '1.72',
'Date::Parse' => '2.24',
- 'Digest::SHA1' => '2.01',
+ 'Digest::SHA' => '0',
'Fcntl' => '1.03',
'File::Find' => '0',
'File::NFSLock' => '1.20',
@@ -29,6 +29,7 @@ my $builder = Test::Run::Builder->new(
'Storable' => '1.00',
'Symbol' => '1.02',
'Test::More' => '0.45',
+ 'perl' => '5.006',
},
configure_requires =>
{
@@ -1,3 +1,30 @@
+2014-05-13
+ - Fix a small grammar in the docs (double "as") reported by pink_mist.
+ - Thanks, pink_mist!
+ - Another fix for a small typo by pink_mist.
+ - Thanks again.
+ - Add Cache category of warnings to make sure warnings do not emit
+ an error.
+ - See https://rt.cpan.org/Public/Bug/Display.html?id=95608
+ - Thanks to Gabor Szabo for the report.
+ - Bugfix/maintenance release (2.10)
+
+2014-02-02
+ - Use Digest::SHA instead of Digest::SHA1
+ - Digest::SHA is core and preferred by Debian.
+ - https://rt.cpan.org/Ticket/Display.html?id=92658
+ - Bugfix/maintenance release (2.09)
+
+2014-01-26
+ - Convert from use "warnings::register;" to "use warnings;".
+ - Bugfix/maintenance release (2.08)
+
+2014-01-26
+ - Add perl to the prereq in META.yml/META.json
+ - Kwalitee / CPANTS
+ - Bugfix/maintenance release (2.07)
+
+2013-09-13
- Increase the delay of the cache invalidation in the tests by default to
avoid test failures due to high load.
- https://rt.cpan.org/Public/Bug/Display.html?id=27280
@@ -4,7 +4,7 @@
"Chris Leishman <chris@leishman.org>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.4007, CPAN::Meta::Converter version 2.132510",
+ "generated_by" : "Module::Build version 0.4205",
"keywords" : [
"cache",
"caching",
@@ -35,7 +35,7 @@
"requires" : {
"DB_File" : "1.72",
"Date::Parse" : "2.24",
- "Digest::SHA1" : "2.01",
+ "Digest::SHA" : "0",
"Fcntl" : "1.03",
"File::Find" : "0",
"File::NFSLock" : "1.20",
@@ -47,59 +47,60 @@
"IO::String" : "1.02",
"Storable" : "1.00",
"Symbol" : "1.02",
- "Test::More" : "0.45"
+ "Test::More" : "0.45",
+ "perl" : "5.006"
}
}
},
"provides" : {
"Cache" : {
"file" : "lib/Cache.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::Entry" : {
"file" : "lib/Cache/Entry.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::File" : {
"file" : "lib/Cache/File.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::File::Entry" : {
"file" : "lib/Cache/File/Entry.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::File::Handle" : {
"file" : "lib/Cache/File/Handle.pm"
},
"Cache::File::Heap" : {
"file" : "lib/Cache/File/Heap.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::IOString" : {
"file" : "lib/Cache/IOString.pm"
},
"Cache::Memory" : {
"file" : "lib/Cache/Memory.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::Memory::Entry" : {
"file" : "lib/Cache/Memory/Entry.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::Memory::HeapElem" : {
"file" : "lib/Cache/Memory/HeapElem.pm"
},
"Cache::Null" : {
"file" : "lib/Cache/Null.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::Null::Entry" : {
"file" : "lib/Cache/Null/Entry.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::RemovalStrategy" : {
"file" : "lib/Cache/RemovalStrategy.pm",
- "version" : "2.06"
+ "version" : "2.10"
},
"Cache::RemovalStrategy::FIFO" : {
"file" : "lib/Cache/RemovalStrategy/FIFO.pm"
@@ -109,7 +110,7 @@
},
"Cache::Tester" : {
"file" : "lib/Cache/Tester.pm",
- "version" : "2.06"
+ "version" : "2.10"
}
},
"release_status" : "stable",
@@ -121,5 +122,5 @@
"url" : "http://bitbucket.org/shlomif/web-cpan"
}
},
- "version" : "2.06"
+ "version" : "2.10"
}
@@ -4,9 +4,9 @@ author:
- 'Chris Leishman <chris@leishman.org>'
build_requires: {}
configure_requires:
- Module::Build: 0
+ Module::Build: '0'
dynamic_config: 1
-generated_by: 'Module::Build version 0.4007, CPAN::Meta::Converter version 2.132510'
+generated_by: 'Module::Build version 0.4205, CPAN::Meta::Converter version 2.141170'
keywords:
- cache
- caching
@@ -21,69 +21,70 @@ keywords:
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Cache
provides:
Cache:
file: lib/Cache.pm
- version: 2.06
+ version: '2.10'
Cache::Entry:
file: lib/Cache/Entry.pm
- version: 2.06
+ version: '2.10'
Cache::File:
file: lib/Cache/File.pm
- version: 2.06
+ version: '2.10'
Cache::File::Entry:
file: lib/Cache/File/Entry.pm
- version: 2.06
+ version: '2.10'
Cache::File::Handle:
file: lib/Cache/File/Handle.pm
Cache::File::Heap:
file: lib/Cache/File/Heap.pm
- version: 2.06
+ version: '2.10'
Cache::IOString:
file: lib/Cache/IOString.pm
Cache::Memory:
file: lib/Cache/Memory.pm
- version: 2.06
+ version: '2.10'
Cache::Memory::Entry:
file: lib/Cache/Memory/Entry.pm
- version: 2.06
+ version: '2.10'
Cache::Memory::HeapElem:
file: lib/Cache/Memory/HeapElem.pm
Cache::Null:
file: lib/Cache/Null.pm
- version: 2.06
+ version: '2.10'
Cache::Null::Entry:
file: lib/Cache/Null/Entry.pm
- version: 2.06
+ version: '2.10'
Cache::RemovalStrategy:
file: lib/Cache/RemovalStrategy.pm
- version: 2.06
+ version: '2.10'
Cache::RemovalStrategy::FIFO:
file: lib/Cache/RemovalStrategy/FIFO.pm
Cache::RemovalStrategy::LRU:
file: lib/Cache/RemovalStrategy/LRU.pm
Cache::Tester:
file: lib/Cache/Tester.pm
- version: 2.06
+ version: '2.10'
requires:
- DB_File: 1.72
- Date::Parse: 2.24
- Digest::SHA1: 2.01
- Fcntl: 1.03
- File::Find: 0
- File::NFSLock: 1.20
- File::Path: 1.00
- File::Spec: 0.8
- Heap::Fibonacci: 0.01
- IO::File: 1.08
- IO::Handle: 1.21
- IO::String: 1.02
- Storable: 1.00
- Symbol: 1.02
- Test::More: 0.45
+ DB_File: '1.72'
+ Date::Parse: '2.24'
+ Digest::SHA: '0'
+ Fcntl: '1.03'
+ File::Find: '0'
+ File::NFSLock: '1.20'
+ File::Path: '1.00'
+ File::Spec: '0.8'
+ Heap::Fibonacci: '0.01'
+ IO::File: '1.08'
+ IO::Handle: '1.21'
+ IO::String: '1.02'
+ Storable: '1.00'
+ Symbol: '1.02'
+ Test::More: '0.45'
+ perl: '5.006'
resources:
license: http://dev.perl.org/licenses/
repository: http://bitbucket.org/shlomif/web-cpan
-version: 2.06
+version: '2.10'
@@ -39,7 +39,7 @@ use Carp;
use fields qw(cache key);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
sub new {
@@ -30,7 +30,7 @@ use Carp;
use base qw(Cache::Entry);
use fields qw(dir path lockdetails);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
# hash of locks held my the process, keyed on path. This is useful for
# catching potential deadlocks and warning the user, and for implementing
@@ -31,7 +31,7 @@ use Carp;
use fields qw(db dbhash);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
# common info object
my $BTREEINFO = new DB_File::BTREEINFO;
@@ -25,7 +25,7 @@ use strict;
use warnings;
use Cache::File::Heap;
use Cache::File::Entry;
-use Digest::SHA1 qw(sha1_hex);
+use Digest::SHA qw(sha1_hex);
use Fcntl qw(LOCK_EX LOCK_NB);
use Symbol ();
use File::Spec;
@@ -41,7 +41,7 @@ use fields qw(
expheap ageheap useheap index lockfile
lock lockcount openexp openage openuse openidx);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
sub LOCK_NONE () { 0 }
sub LOCK_LOCAL () { 1 }
@@ -25,7 +25,7 @@ use Carp;
use base qw(Cache::Entry);
use fields qw(store_entry);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
sub new {
@@ -34,7 +34,7 @@ use Cache::Memory::Entry;
use base qw(Cache);
use fields qw(namespace);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
# storage for all data
@@ -79,6 +79,15 @@ available properties that can be set.
=cut
+sub _init_ns_heaps {
+ my ($self, $ns) = @_;
+
+ $Age_Heaps{$ns} ||= Heap::Fibonacci->new();
+ $Use_Heaps{$ns} ||= Heap::Fibonacci->new();
+
+ return;
+}
+
sub new {
my Cache::Memory $self = shift;
my $args = $#_? { @_ } : shift;
@@ -89,9 +98,7 @@ sub new {
my $ns = $args->{namespace} || $DEFAULT_NAMESPACE;
$self->{namespace} = $ns;
- # init heaps
- $Age_Heaps{$ns} ||= Heap::Fibonacci->new();
- $Use_Heaps{$ns} ||= Heap::Fibonacci->new();
+ $self->_init_ns_heaps($ns);
return $self;
}
@@ -169,8 +176,9 @@ sub clear {
$Store_Sizes{$ns} = 0;
# recreate age and used heaps (thus emptying them)
- $Age_Heaps{$ns} = Heap::Fibonacci->new();
- $Use_Heaps{$ns} = Heap::Fibonacci->new();
+ $self->_init_ns_heaps($ns);
+
+ return;
}
sub count {
@@ -211,8 +219,7 @@ sub set_namespace {
my Cache::Memory $self = shift;
my ($namespace) = @_;
- $Age_Heaps{$namespace} ||= Heap::Fibonacci->new();
- $Use_Heaps{$namespace} ||= Heap::Fibonacci->new();
+ $self->_init_ns_heaps($namespace);
$self->{namespace} = $namespace;
}
@@ -23,7 +23,7 @@ use Cache::IOString;
use base qw(Cache::Entry);
use fields qw();
-our $VERSION = '2.06';
+our $VERSION = '2.10';
sub new {
@@ -28,7 +28,7 @@ use Cache::Null::Entry;
use base qw(Cache);
use fields qw(cache_root);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
=head1 CONSTRUCTOR
@@ -16,7 +16,7 @@ use strict;
use warnings;
use Carp;
-our $VERSION = '2.06';
+our $VERSION = '2.10';
sub new {
@@ -32,7 +32,7 @@ use vars qw(@ISA @EXPORT $VERSION $CACHE_TESTS);
use Carp;
@ISA = qw(Exporter Test::More);
-$VERSION = '2.06';
+$VERSION = '2.10';
@EXPORT = (qw(run_cache_tests $CACHE_TESTS), @Test::More::EXPORT);
$CACHE_TESTS = 79;
@@ -10,7 +10,7 @@ store data locally to save repeated and redundant expensive calls to remote
machines or databases.
The Cache interface is implemented by derived classes that store cached data
-in different manners (such as as files on a filesystem, or in memory).
+in different manners (such as files on a filesystem, or in memory).
=head1 USAGE
@@ -45,16 +45,20 @@ package Cache;
require 5.006;
use strict;
-use warnings::register;
+use warnings;
use Carp;
use Date::Parse;
+# For registering the 'Cache' category. See:
+# https://rt.cpan.org/Public/Bug/Display.html?id=95608
+use warnings::register;
+
use base qw(Tie::Hash);
use fields qw(
default_expires removal_strategy size_limit
load_callback validate_callback);
-our $VERSION = '2.06';
+our $VERSION = '2.10';
our $EXPIRES_NOW = 'now';
our $EXPIRES_NEVER = 'never';
@@ -614,7 +618,7 @@ the storage medium.
=item Cache::File no longer supports separate masks for entries and
directories. It is not a very secure configuration and presents numerous
-issues for cache consistency and is hence depricated. There is still some
+issues for cache consistency and is hence deprecated. There is still some
work to be done to ensure cache consistency between accesses by different
users.
@@ -7,7 +7,7 @@ use Carp;
$SIG{__DIE__} = sub { confess @_; };
-BEGIN { plan tests => 2 + $CACHE_TESTS + 3 }
+BEGIN { plan tests => 2 + $CACHE_TESTS + 3 + 1 }
use_ok('Cache::File');
@@ -23,12 +23,31 @@ use_ok('Cache::File');
}
{
+ my $tempdir = tempdir(CLEANUP => 1);
+ my $cache = Cache::File->new(cache_root => $tempdir,);
+ {
+ # See:
+ # https://rt.cpan.org/Public/Bug/Display.html?id=95608
+ my $warning;
+ {
+ local $SIG{__WARN__} = sub { $warning = shift; };
+
+ $cache->set ('test', {x => 23}, '10 s');
+ }
+ like ($warning, qr/\AReference passed to set/,
+ "Got the right warning on passing a reference to set.")
+
+ }
+}
+
+{
# Test setting of umask
umask 077;
my $tempdir = tempdir(CLEANUP => 1);
my $cache = Cache::File->new(cache_root => $tempdir, cache_umask => 070);
ok($cache, 'Cache created');
+
my $entry = $cache->set('key1', 'data1');
is($cache->count(), 1, 'Added entry');