Hello community, here is the log from the commit of package perl-CHI for openSUSE:Factory checked in at 2012-03-16 13:20:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-CHI (Old) and /work/SRC/openSUSE:Factory/.perl-CHI.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-CHI", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-CHI/perl-CHI.changes 2012-02-16 16:21:34.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-CHI.new/perl-CHI.changes 2012-03-16 13:20:33.000000000 +0100 @@ -1,0 +2,14 @@ +Mon Mar 12 14:44:54 UTC 2012 - [email protected] + +- updated to 0.52 + - Subclasses inherit configuration from their parents unless they + also call config() + - Fix Config test to not require memcached + +- changes from 0.51 + - add CHI->config() to register storage types, and set core and + per-namespace defaults + - fix new test_max_key_length test to work on drivers that do not + support get_keys + +------------------------------------------------------------------- Old: ---- CHI-0.50.tar.gz New: ---- CHI-0.52.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-CHI.spec ++++++ --- /var/tmp/diff_new_pack.dZvPph/_old 2012-03-16 13:20:35.000000000 +0100 +++ /var/tmp/diff_new_pack.dZvPph/_new 2012-03-16 13:20:35.000000000 +0100 @@ -18,7 +18,7 @@ Name: perl-CHI -Version: 0.50 +Version: 0.52 Release: 1 License: GPL-1.0+ or Artistic-1.0 %define cpan_name CHI @@ -33,8 +33,8 @@ BuildRequires: perl(Carp::Assert) >= 0.20 BuildRequires: perl(Data::UUID) BuildRequires: perl(Date::Parse) -BuildRequires: perl(Digest::JHash) BuildRequires: perl(Digest::MD5) +BuildRequires: perl(Digest::JHash) BuildRequires: perl(File::Spec) >= 0.80 BuildRequires: perl(Hash::MoreUtils) BuildRequires: perl(JSON) @@ -72,6 +72,7 @@ #BuildRequires: perl(CHI::Serializer::Storable) #BuildRequires: perl(CHI::Stats) #BuildRequires: perl(CHI::t::Bugs) +#BuildRequires: perl(CHI::t::Config) #BuildRequires: perl(CHI::t::Constants) #BuildRequires: perl(CHI::t::Driver) #BuildRequires: perl(CHI::t::Driver::CacheCache) @@ -110,6 +111,7 @@ #BuildRequires: perl(Module::Mask) #BuildRequires: perl(Moose::Role) #BuildRequires: perl(Moose::Util::TypeConstraints) +#BuildRequires: perl(My::CHI) #BuildRequires: perl(Test::Pod) #BuildRequires: perl(Text::Table) #BuildRequires: perl(YAML::Any) @@ -117,8 +119,8 @@ Requires: perl(Data::UUID) Requires: perl(Digest::JHash) Requires: perl(Digest::MD5) -Requires: perl(File::Spec) >= 0.80 Requires: perl(Hash::MoreUtils) +Requires: perl(File::Spec) >= 0.80 Requires: perl(JSON) Requires: perl(List::MoreUtils) >= 0.13 Requires: perl(Log::Any) >= 0.08 ++++++ CHI-0.50.tar.gz -> CHI-0.52.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/Changes new/CHI-0.52/Changes --- old/CHI-0.50/Changes 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/Changes 2012-03-08 08:58:09.000000000 +0100 @@ -2,6 +2,22 @@ ** denotes an incompatible change +0.52 Mar 7, 2012 + +* Improvements + - Subclasses inherit configuration from their parents unless they also call config() + +* Fixes + - Fix Config test to not require memcached + +0.51 Mar 4, 2012 + +* Improvements + - Add CHI->config() to register storage types, and set core and per-namespace defaults + +* Fixes + - Fix new test_max_key_length test to work on drivers that do not support get_keys + 0.50 Nov 30, 2011 * Docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/MANIFEST new/CHI-0.52/MANIFEST --- old/CHI-0.50/MANIFEST 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/MANIFEST 2012-03-08 08:58:09.000000000 +0100 @@ -37,6 +37,7 @@ lib/CHI/Types.pm lib/CHI/Util.pm lib/CHI/t/Bugs.pm +lib/CHI/t/Config.pm lib/CHI/t/Constants.pm lib/CHI/t/Driver.pm lib/CHI/t/Driver/CacheCache.pm @@ -60,6 +61,7 @@ lib/CHI/t/Util.pm t/00-load.t t/Bugs.t +t/Config.t t/Constants.t t/Driver-Memory.t t/Driver-RawMemory.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/META.json new/CHI-0.52/META.json --- old/CHI-0.50/META.json 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/META.json 2012-03-08 08:58:09.000000000 +0100 @@ -4,7 +4,7 @@ "Jonathan Swartz <[email protected]>" ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.102400", + "generated_by" : "Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.113640", "license" : [ "perl_5" ], @@ -77,6 +77,6 @@ "web" : "https://github.com/jonswar/perl-chi" } }, - "version" : "0.50" + "version" : "0.52" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/META.yml new/CHI-0.52/META.yml --- old/CHI-0.50/META.yml 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/META.yml 2012-03-08 08:58:09.000000000 +0100 @@ -13,7 +13,7 @@ configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 -generated_by: 'Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.102400' +generated_by: 'Dist::Zilla version 4.200008, CPAN::Meta::Converter version 2.113640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -50,4 +50,4 @@ resources: bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=CHI repository: git://github.com/jonswar/perl-chi.git -version: 0.50 +version: 0.52 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/Makefile.PL new/CHI-0.52/Makefile.PL --- old/CHI-0.50/Makefile.PL 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/Makefile.PL 2012-03-08 08:58:09.000000000 +0100 @@ -44,7 +44,7 @@ 'Time::Duration::Parse' => '0.03', 'Try::Tiny' => '0.05' }, - 'VERSION' => '0.50', + 'VERSION' => '0.52', 'test' => { 'TESTS' => 't/*.t' } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/README new/CHI-0.52/README --- old/CHI-0.50/README 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/README 2012-03-08 08:58:10.000000000 +0100 @@ -2,7 +2,7 @@ CHI - Unified cache handling interface VERSION - version 0.50 + version 0.52 SYNOPSIS use CHI; @@ -79,7 +79,7 @@ * CHI::Driver::Memory - In-process memory based cache * CHI::Driver::RawMemory - In-process memory based cache that stores - references directly instead of deep-copying + references directly instead of serializing/deep-copying * CHI::Driver::File - File-based cache using one file per entry in a multi-level directory structure @@ -163,7 +163,8 @@ Serialization CHI handles its own serialization, passing a flat binary string to - the underlying cache backend. + the underlying cache backend. The notable exception is + CHI::Driver::RawMemory which does no serialization. Expiration CHI packs expiration times (as well as other metadata) inside the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Benchmarks.pod new/CHI-0.52/lib/CHI/Benchmarks.pod --- old/CHI-0.50/lib/CHI/Benchmarks.pod 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Benchmarks.pod 2012-03-08 08:58:09.000000000 +0100 @@ -9,7 +9,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/CacheObject.pm new/CHI-0.52/lib/CHI/CacheObject.pm --- old/CHI-0.50/lib/CHI/CacheObject.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/CacheObject.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::CacheObject; BEGIN { - $CHI::CacheObject::VERSION = '0.50'; + $CHI::CacheObject::VERSION = '0.52'; } use CHI::Constants qw(CHI_Max_Time); use Encode; @@ -180,7 +180,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Constants.pm new/CHI-0.52/lib/CHI/Constants.pm --- old/CHI-0.50/lib/CHI/Constants.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Constants.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Constants; BEGIN { - $CHI::Constants::VERSION = '0.50'; + $CHI::Constants::VERSION = '0.52'; } use strict; use warnings; @@ -28,7 +28,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Base/CacheContainer.pm new/CHI-0.52/lib/CHI/Driver/Base/CacheContainer.pm --- old/CHI-0.50/lib/CHI/Driver/Base/CacheContainer.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Base/CacheContainer.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Base::CacheContainer; BEGIN { - $CHI::Driver::Base::CacheContainer::VERSION = '0.50'; + $CHI::Driver::Base::CacheContainer::VERSION = '0.52'; } use Moose; use Moose::Util::TypeConstraints; @@ -62,7 +62,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/CacheCache.pm new/CHI-0.52/lib/CHI/Driver/CacheCache.pm --- old/CHI-0.50/lib/CHI/Driver/CacheCache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/CacheCache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::CacheCache; BEGIN { - $CHI::Driver::CacheCache::VERSION = '0.50'; + $CHI::Driver::CacheCache::VERSION = '0.52'; } use Cache::Cache; use Carp; @@ -47,7 +47,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Development.pod new/CHI-0.52/lib/CHI/Driver/Development.pod --- old/CHI-0.50/lib/CHI/Driver/Development.pod 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Development.pod 2012-03-08 08:58:09.000000000 +0100 @@ -9,7 +9,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS @@ -149,7 +149,7 @@ =head2 Overridable methods -The following methods have a default implementation, but MAY be overriden by +The following methods have a default implementation, but MAY be overridden by your subclass: =over diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/FastMmap.pm new/CHI-0.52/lib/CHI/Driver/FastMmap.pm --- old/CHI-0.50/lib/CHI/Driver/FastMmap.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/FastMmap.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::FastMmap; BEGIN { - $CHI::Driver::FastMmap::VERSION = '0.50'; + $CHI::Driver::FastMmap::VERSION = '0.52'; } use Carp; use Cache::FastMmap; @@ -89,7 +89,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/File.pm new/CHI-0.52/lib/CHI/Driver/File.pm --- old/CHI-0.50/lib/CHI/Driver/File.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/File.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::File; BEGIN { - $CHI::Driver::File::VERSION = '0.50'; + $CHI::Driver::File::VERSION = '0.52'; } use Carp; use Cwd qw(realpath cwd); @@ -248,7 +248,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Memory.pm new/CHI-0.52/lib/CHI/Driver/Memory.pm --- old/CHI-0.50/lib/CHI/Driver/Memory.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Memory.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Memory; BEGIN { - $CHI::Driver::Memory::VERSION = '0.50'; + $CHI::Driver::Memory::VERSION = '0.52'; } use Carp qw(cluck croak); use CHI::Constants qw(CHI_Meta_Namespace); @@ -105,7 +105,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Metacache.pm new/CHI-0.52/lib/CHI/Driver/Metacache.pm --- old/CHI-0.50/lib/CHI/Driver/Metacache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Metacache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Metacache; BEGIN { - $CHI::Driver::Metacache::VERSION = '0.50'; + $CHI::Driver::Metacache::VERSION = '0.52'; } use CHI::Constants qw(CHI_Meta_Namespace); use Moose; @@ -66,7 +66,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Null.pm new/CHI-0.52/lib/CHI/Driver/Null.pm --- old/CHI-0.50/lib/CHI/Driver/Null.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Null.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Null; BEGIN { - $CHI::Driver::Null::VERSION = '0.50'; + $CHI::Driver::Null::VERSION = '0.52'; } use Moose; use strict; @@ -28,7 +28,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/RawMemory.pm new/CHI-0.52/lib/CHI/Driver/RawMemory.pm --- old/CHI-0.50/lib/CHI/Driver/RawMemory.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/RawMemory.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::RawMemory; BEGIN { - $CHI::Driver::RawMemory::VERSION = '0.50'; + $CHI::Driver::RawMemory::VERSION = '0.52'; } use Moose; use strict; @@ -30,7 +30,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Role/HasSubcaches.pm new/CHI-0.52/lib/CHI/Driver/Role/HasSubcaches.pm --- old/CHI-0.50/lib/CHI/Driver/Role/HasSubcaches.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Role/HasSubcaches.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Role::HasSubcaches; BEGIN { - $CHI::Driver::Role::HasSubcaches::VERSION = '0.50'; + $CHI::Driver::Role::HasSubcaches::VERSION = '0.52'; } use Moose::Role; use Hash::MoreUtils qw(slice_exists); @@ -38,7 +38,7 @@ qw(expires_at expires_in expires_variance namespace on_get_error on_set_error serializer) ); -# List of parameters that cannot be overriden in a subcache +# List of parameters that cannot be overridden in a subcache # my @subcache_nonoverride_param_keys = (qw(expires_at expires_in expires_variance serializer)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Role/IsSizeAware.pm new/CHI-0.52/lib/CHI/Driver/Role/IsSizeAware.pm --- old/CHI-0.50/lib/CHI/Driver/Role/IsSizeAware.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Role/IsSizeAware.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Role::IsSizeAware; BEGIN { - $CHI::Driver::Role::IsSizeAware::VERSION = '0.50'; + $CHI::Driver::Role::IsSizeAware::VERSION = '0.52'; } use Carp::Assert; use Moose::Role; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Role/IsSubcache.pm new/CHI-0.52/lib/CHI/Driver/Role/IsSubcache.pm --- old/CHI-0.50/lib/CHI/Driver/Role/IsSubcache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Role/IsSubcache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Role::IsSubcache; BEGIN { - $CHI::Driver::Role::IsSubcache::VERSION = '0.50'; + $CHI::Driver::Role::IsSubcache::VERSION = '0.52'; } use Moose::Role; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver/Role/Universal.pm new/CHI-0.52/lib/CHI/Driver/Role/Universal.pm --- old/CHI-0.50/lib/CHI/Driver/Role/Universal.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver/Role/Universal.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver::Role::Universal; BEGIN { - $CHI::Driver::Role::Universal::VERSION = '0.50'; + $CHI::Driver::Role::Universal::VERSION = '0.52'; } use CHI::Constants qw(CHI_Meta_Namespace); use Moose::Role; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Driver.pm new/CHI-0.52/lib/CHI/Driver.pm --- old/CHI-0.50/lib/CHI/Driver.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Driver.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Driver; BEGIN { - $CHI::Driver::VERSION = '0.50'; + $CHI::Driver::VERSION = '0.52'; } use Carp; use CHI::CacheObject; @@ -50,6 +50,7 @@ has 'on_set_error' => ( is => 'rw', isa => 'CHI::Types::OnError', default => 'log' ); has 'serializer' => ( is => 'ro', isa => 'CHI::Types::Serializer', coerce => 1, default => sub { $default_serializer } ); has 'short_driver_name' => ( is => 'ro', lazy_build => 1 ); +has 'storage' => ( is => 'ro' ); # These methods must be implemented by subclass foreach my $method (qw(fetch store remove get_keys get_namespaces)) { @@ -697,7 +698,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Serializer/JSON.pm new/CHI-0.52/lib/CHI/Serializer/JSON.pm --- old/CHI-0.50/lib/CHI/Serializer/JSON.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Serializer/JSON.pm 2012-03-08 08:58:09.000000000 +0100 @@ -3,7 +3,7 @@ # package CHI::Serializer::JSON; BEGIN { - $CHI::Serializer::JSON::VERSION = '0.50'; + $CHI::Serializer::JSON::VERSION = '0.52'; } use Moose; use JSON; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Serializer/Storable.pm new/CHI-0.52/lib/CHI/Serializer/Storable.pm --- old/CHI-0.50/lib/CHI/Serializer/Storable.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Serializer/Storable.pm 2012-03-08 08:58:09.000000000 +0100 @@ -3,7 +3,7 @@ # package CHI::Serializer::Storable; BEGIN { - $CHI::Serializer::Storable::VERSION = '0.50'; + $CHI::Serializer::Storable::VERSION = '0.52'; } use Moose; use Storable; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Stats.pm new/CHI-0.52/lib/CHI/Stats.pm --- old/CHI-0.50/lib/CHI/Stats.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Stats.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Stats; BEGIN { - $CHI::Stats::VERSION = '0.50'; + $CHI::Stats::VERSION = '0.52'; } use Log::Any qw($log); use Moose; @@ -137,7 +137,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Class.pm new/CHI-0.52/lib/CHI/Test/Class.pm --- old/CHI-0.50/lib/CHI/Test/Class.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Class.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Class; BEGIN { - $CHI::Test::Class::VERSION = '0.50'; + $CHI::Test::Class::VERSION = '0.52'; } use Getopt::Long; use CHI::Util qw(can_load); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Driver/NonMoose.pm new/CHI-0.52/lib/CHI/Test/Driver/NonMoose.pm --- old/CHI-0.50/lib/CHI/Test/Driver/NonMoose.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Driver/NonMoose.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Driver::NonMoose; BEGIN { - $CHI::Test::Driver::NonMoose::VERSION = '0.50'; + $CHI::Test::Driver::NonMoose::VERSION = '0.52'; } use Carp; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Driver/Readonly.pm new/CHI-0.52/lib/CHI/Test/Driver/Readonly.pm --- old/CHI-0.50/lib/CHI/Test/Driver/Readonly.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Driver/Readonly.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Driver::Readonly; BEGIN { - $CHI::Test::Driver::Readonly::VERSION = '0.50'; + $CHI::Test::Driver::Readonly::VERSION = '0.52'; } use Carp; use Moose; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Driver/Role/CheckKeyValidity.pm new/CHI-0.52/lib/CHI/Test/Driver/Role/CheckKeyValidity.pm --- old/CHI-0.50/lib/CHI/Test/Driver/Role/CheckKeyValidity.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Driver/Role/CheckKeyValidity.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Driver::Role::CheckKeyValidity; BEGIN { - $CHI::Test::Driver::Role::CheckKeyValidity::VERSION = '0.50'; + $CHI::Test::Driver::Role::CheckKeyValidity::VERSION = '0.52'; } use Carp; use Moose::Role; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Driver/Writeonly.pm new/CHI-0.52/lib/CHI/Test/Driver/Writeonly.pm --- old/CHI-0.50/lib/CHI/Test/Driver/Writeonly.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Driver/Writeonly.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Driver::Writeonly; BEGIN { - $CHI::Test::Driver::Writeonly::VERSION = '0.50'; + $CHI::Test::Driver::Writeonly::VERSION = '0.52'; } use Carp; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test/Util.pm new/CHI-0.52/lib/CHI/Test/Util.pm --- old/CHI-0.50/lib/CHI/Test/Util.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test/Util.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Test::Util; BEGIN { - $CHI::Test::Util::VERSION = '0.50'; + $CHI::Test::Util::VERSION = '0.52'; } use Date::Parse; use Test::Builder; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Test.pm new/CHI-0.52/lib/CHI/Test.pm --- old/CHI-0.50/lib/CHI/Test.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Test.pm 2012-03-08 08:58:09.000000000 +0100 @@ -2,7 +2,7 @@ # package CHI::Test; BEGIN { - $CHI::Test::VERSION = '0.50'; + $CHI::Test::VERSION = '0.52'; } use Log::Any::Test; # as early as possible use List::MoreUtils qw(uniq); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Types.pm new/CHI-0.52/lib/CHI/Types.pm --- old/CHI-0.50/lib/CHI/Types.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Types.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Types; BEGIN { - $CHI::Types::VERSION = '0.50'; + $CHI::Types::VERSION = '0.52'; } use Carp; use CHI::Util qw(can_load parse_duration parse_memory_size); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/Util.pm new/CHI-0.52/lib/CHI/Util.pm --- old/CHI-0.50/lib/CHI/Util.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/Util.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::Util; BEGIN { - $CHI::Util::VERSION = '0.50'; + $CHI::Util::VERSION = '0.52'; } use Carp qw( croak longmess ); use Class::MOP; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Bugs.pm new/CHI-0.52/lib/CHI/t/Bugs.pm --- old/CHI-0.50/lib/CHI/t/Bugs.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Bugs.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Bugs; BEGIN { - $CHI::t::Bugs::VERSION = '0.50'; + $CHI::t::Bugs::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Config.pm new/CHI-0.52/lib/CHI/t/Config.pm --- old/CHI-0.50/lib/CHI/t/Config.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Config.pm 2012-03-08 08:58:09.000000000 +0100 @@ -0,0 +1,143 @@ +package CHI::t::Config; +BEGIN { + $CHI::t::Config::VERSION = '0.52'; +} +use CHI::Util qw(dump_one_line); +use CHI::Test; +use File::Temp qw(tempdir); +use strict; +use warnings; +use base qw(CHI::Test::Class); + +my $root_dir = tempdir( 'CHI-t-Config-XXXX', TMPDIR => 1, CLEANUP => 1 ); + +my %config = ( + storage => { + memory => { driver => 'Memory', global => 1 }, + file => { driver => 'File', root_dir => $root_dir }, + }, + namespace => { + 'Foo' => { storage => 'file' }, + 'Bar' => { storage => 'file', depth => 3 }, + }, + defaults => { storage => 'memory' }, +); + +{ + package My::CHI; +BEGIN { + $My::CHI::VERSION = '0.52'; +} + use base qw(CHI); + My::CHI->config( {%config} ); +} + +{ + package My::CHI::Subclass; +BEGIN { + $My::CHI::Subclass::VERSION = '0.52'; +} + use base qw(My::CHI); +} + +{ + package My::CHI::Memo; +BEGIN { + $My::CHI::Memo::VERSION = '0.52'; +} + use base qw(CHI); + My::CHI::Memo->config( { %config, memoize_cache_objects => 1 } ); +} + +sub _create { + my ( $params, $checks ) = @_; + + my $desc = dump_one_line($params); + foreach my $class (qw(My::CHI My::CHI::Subclass)) { + my $cache = $class->new(%$params); + while ( my ( $key, $value ) = each(%$checks) ) { + is( $cache->$key, $value, "$key == $value ($desc)" ); + } + } +} + +sub test_config : Tests { + my $self = shift; + + _create( + { namespace => 'Foo' }, + { + namespace => 'Foo', + storage => 'file', + short_driver_name => 'File', + root_dir => $root_dir, + depth => 2 + }, + ); + _create( + { namespace => 'Bar' }, + { + namespace => 'Bar', + storage => 'file', + short_driver_name => 'File', + root_dir => $root_dir, + depth => 3 + } + ); + _create( + { namespace => 'Foo', depth => 4 }, + { + namespace => 'Foo', + storage => 'file', + short_driver_name => 'File', + root_dir => $root_dir, + depth => 4 + } + ); + _create( + { namespace => 'Bar', depth => 4 }, + { + namespace => 'Bar', + storage => 'file', + short_driver_name => 'File', + root_dir => $root_dir, + depth => 4 + } + ); + + my %new_config = %config; + $new_config{namespace}->{'Bar'}->{depth} = 5; + My::CHI->config( {%new_config} ); + _create( + { namespace => 'Bar' }, + { + namespace => 'Bar', + storage => 'file', + short_driver_name => 'File', + root_dir => $root_dir, + depth => 5 + } + ); +} + +sub test_memoize : Tests { + my $cache1 = My::CHI::Memo->new( namespace => 'Foo' ); + my $cache2 = My::CHI::Memo->new( namespace => 'Foo' ); + is( $cache1, $cache2, "same - namespace Foo" ); + + my $cache3 = My::CHI::Memo->new( namespace => 'Bar', depth => 4 ); + my $cache4 = My::CHI::Memo->new( namespace => 'Bar', depth => 4 ); + isnt( $cache3, $cache4, "different - namespace Bar" ); + + My::CHI::Memo->clear_memoized_cache_objects(); + my $cache5 = My::CHI::Memo->new( namespace => 'Foo' ); + my $cache6 = My::CHI::Memo->new( namespace => 'Foo' ); + is( $cache5, $cache6, "same - namespace Foo" ); + isnt( $cache1, $cache3, "different - post-clear" ); + + my $cache7 = My::CHI->new( namespace => 'Foo' ); + my $cache8 = My::CHI->new( namespace => 'Foo' ); + isnt( $cache7, $cache8, "different - namespace Foo - no memoization" ); +} + +1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Constants.pm new/CHI-0.52/lib/CHI/t/Constants.pm --- old/CHI-0.50/lib/CHI/t/Constants.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Constants.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Constants; BEGIN { - $CHI::t::Constants::VERSION = '0.50'; + $CHI::t::Constants::VERSION = '0.52'; } use strict; use warnings; @@ -11,21 +11,21 @@ { package Foo; BEGIN { - $Foo::VERSION = '0.50'; + $Foo::VERSION = '0.52'; } use CHI::Constants qw(CHI_Meta_Namespace); } { package Bar; BEGIN { - $Bar::VERSION = '0.50'; + $Bar::VERSION = '0.52'; } use CHI::Constants qw(:all); } { package Baz; BEGIN { - $Baz::VERSION = '0.50'; + $Baz::VERSION = '0.52'; } } is( Foo::CHI_Meta_Namespace, '_CHI_METACACHE' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/CacheCache.pm new/CHI-0.52/lib/CHI/t/Driver/CacheCache.pm --- old/CHI-0.50/lib/CHI/t/Driver/CacheCache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/CacheCache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::CacheCache; BEGIN { - $CHI::t::Driver::CacheCache::VERSION = '0.50'; + $CHI::t::Driver::CacheCache::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/FastMmap.pm new/CHI-0.52/lib/CHI/t/Driver/FastMmap.pm --- old/CHI-0.50/lib/CHI/t/Driver/FastMmap.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/FastMmap.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::FastMmap; BEGIN { - $CHI::t::Driver::FastMmap::VERSION = '0.50'; + $CHI::t::Driver::FastMmap::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/File/DepthZero.pm new/CHI-0.52/lib/CHI/t/Driver/File/DepthZero.pm --- old/CHI-0.50/lib/CHI/t/Driver/File/DepthZero.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/File/DepthZero.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::File::DepthZero; BEGIN { - $CHI::t::Driver::File::DepthZero::VERSION = '0.50'; + $CHI::t::Driver::File::DepthZero::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/File.pm new/CHI-0.52/lib/CHI/t/Driver/File.pm --- old/CHI-0.50/lib/CHI/t/Driver/File.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/File.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::File; BEGIN { - $CHI::t::Driver::File::VERSION = '0.50'; + $CHI::t::Driver::File::VERSION = '0.52'; } use strict; use warnings; @@ -24,7 +24,7 @@ { package CHI::t::Driver::File::NoTempDriver; BEGIN { - $CHI::t::Driver::File::NoTempDriver::VERSION = '0.50'; + $CHI::t::Driver::File::NoTempDriver::VERSION = '0.52'; } use Moose; extends 'CHI::Driver::File'; @@ -39,7 +39,7 @@ { package CHI::t::Driver::File::BadTempDriver; BEGIN { - $CHI::t::Driver::File::BadTempDriver::VERSION = '0.50'; + $CHI::t::Driver::File::BadTempDriver::VERSION = '0.52'; } use Moose; extends 'CHI::Driver::File'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/Memory.pm new/CHI-0.52/lib/CHI/t/Driver/Memory.pm --- old/CHI-0.50/lib/CHI/t/Driver/Memory.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/Memory.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::Memory; BEGIN { - $CHI::t::Driver::Memory::VERSION = '0.50'; + $CHI::t::Driver::Memory::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/NonMoose.pm new/CHI-0.52/lib/CHI/t/Driver/NonMoose.pm --- old/CHI-0.50/lib/CHI/t/Driver/NonMoose.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/NonMoose.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::NonMoose; BEGIN { - $CHI::t::Driver::NonMoose::VERSION = '0.50'; + $CHI::t::Driver::NonMoose::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/RawMemory.pm new/CHI-0.52/lib/CHI/t/Driver/RawMemory.pm --- old/CHI-0.50/lib/CHI/t/Driver/RawMemory.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/RawMemory.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::RawMemory; BEGIN { - $CHI::t::Driver::RawMemory::VERSION = '0.50'; + $CHI::t::Driver::RawMemory::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/Subcache/l1_cache.pm new/CHI-0.52/lib/CHI/t/Driver/Subcache/l1_cache.pm --- old/CHI-0.50/lib/CHI/t/Driver/Subcache/l1_cache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/Subcache/l1_cache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::Subcache::l1_cache; BEGIN { - $CHI::t::Driver::Subcache::l1_cache::VERSION = '0.50'; + $CHI::t::Driver::Subcache::l1_cache::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/Subcache/mirror_cache.pm new/CHI-0.52/lib/CHI/t/Driver/Subcache/mirror_cache.pm --- old/CHI-0.50/lib/CHI/t/Driver/Subcache/mirror_cache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/Subcache/mirror_cache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::Subcache::mirror_cache; BEGIN { - $CHI::t::Driver::Subcache::mirror_cache::VERSION = '0.50'; + $CHI::t::Driver::Subcache::mirror_cache::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver/Subcache.pm new/CHI-0.52/lib/CHI/t/Driver/Subcache.pm --- old/CHI-0.50/lib/CHI/t/Driver/Subcache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver/Subcache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver::Subcache; BEGIN { - $CHI::t::Driver::Subcache::VERSION = '0.50'; + $CHI::t::Driver::Subcache::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Driver.pm new/CHI-0.52/lib/CHI/t/Driver.pm --- old/CHI-0.50/lib/CHI/t/Driver.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Driver.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Driver; BEGIN { - $CHI::t::Driver::VERSION = '0.50'; + $CHI::t::Driver::VERSION = '0.52'; } use strict; use warnings; @@ -586,7 +586,7 @@ { package DummySerializer; BEGIN { - $DummySerializer::VERSION = '0.50'; + $DummySerializer::VERSION = '0.52'; } sub serialize { } sub deserialize { } @@ -1853,9 +1853,15 @@ $cache->set( $key, $value ); is( $cache->get($key), $value, $keyname ); is( $cache->mirror_cache->get($key), $value, $keyname ); + if ( $keyname eq 'medium' ) { + is( $cache->get_object($key)->key(), $key, "medium key stored" ); + } + else { + isnt( $cache->get_object($key)->key(), $key, "md5 key stored" ); + is( length( $cache->get_object($key)->key() ), + 32, "md5 key stored" ); + } } - cmp_set( [ $cache->get_keys() ], - [ 'medium', '66b08343f81782986329795e0a422a05' ], 'get_keys' ); } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/GetError.pm new/CHI-0.52/lib/CHI/t/GetError.pm --- old/CHI-0.50/lib/CHI/t/GetError.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/GetError.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::GetError; BEGIN { - $CHI::t::GetError::VERSION = '0.50'; + $CHI::t::GetError::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Initialize.pm new/CHI-0.52/lib/CHI/t/Initialize.pm --- old/CHI-0.50/lib/CHI/t/Initialize.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Initialize.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Initialize; BEGIN { - $CHI::t::Initialize::VERSION = '0.50'; + $CHI::t::Initialize::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Null.pm new/CHI-0.52/lib/CHI/t/Null.pm --- old/CHI-0.50/lib/CHI/t/Null.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Null.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Null; BEGIN { - $CHI::t::Null::VERSION = '0.50'; + $CHI::t::Null::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/RequiredModules.pm new/CHI-0.52/lib/CHI/t/RequiredModules.pm --- old/CHI-0.50/lib/CHI/t/RequiredModules.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/RequiredModules.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::RequiredModules; BEGIN { - $CHI::t::RequiredModules::VERSION = '0.50'; + $CHI::t::RequiredModules::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Sanity.pm new/CHI-0.52/lib/CHI/t/Sanity.pm --- old/CHI-0.50/lib/CHI/t/Sanity.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Sanity.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Sanity; BEGIN { - $CHI::t::Sanity::VERSION = '0.50'; + $CHI::t::Sanity::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/SetError.pm new/CHI-0.52/lib/CHI/t/SetError.pm --- old/CHI-0.50/lib/CHI/t/SetError.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/SetError.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::SetError; BEGIN { - $CHI::t::SetError::VERSION = '0.50'; + $CHI::t::SetError::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Subcache.pm new/CHI-0.52/lib/CHI/t/Subcache.pm --- old/CHI-0.50/lib/CHI/t/Subcache.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Subcache.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Subcache; BEGIN { - $CHI::t::Subcache::VERSION = '0.50'; + $CHI::t::Subcache::VERSION = '0.52'; } use CHI::Test; use CHI::Util qw(can_load); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Subclass.pm new/CHI-0.52/lib/CHI/t/Subclass.pm --- old/CHI-0.50/lib/CHI/t/Subclass.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Subclass.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Subclass; BEGIN { - $CHI::t::Subclass::VERSION = '0.50'; + $CHI::t::Subclass::VERSION = '0.52'; } use strict; use warnings; @@ -12,7 +12,7 @@ { package CHI::t::Subclass::Driver::HasUnsupported; BEGIN { - $CHI::t::Subclass::Driver::HasUnsupported::VERSION = '0.50'; + $CHI::t::Subclass::Driver::HasUnsupported::VERSION = '0.52'; } use Moose; extends 'CHI::Driver::Memory'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI/t/Util.pm new/CHI-0.52/lib/CHI/t/Util.pm --- old/CHI-0.50/lib/CHI/t/Util.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI/t/Util.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,6 +1,6 @@ package CHI::t::Util; BEGIN { - $CHI::t::Util::VERSION = '0.50'; + $CHI::t::Util::VERSION = '0.52'; } use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/lib/CHI.pm new/CHI-0.52/lib/CHI.pm --- old/CHI-0.50/lib/CHI.pm 2011-11-30 22:28:51.000000000 +0100 +++ new/CHI-0.52/lib/CHI.pm 2012-03-08 08:58:09.000000000 +0100 @@ -1,20 +1,54 @@ package CHI; BEGIN { - $CHI::VERSION = '0.50'; + $CHI::VERSION = '0.52'; } use 5.006; use Carp; use CHI::Stats; +use Moose; use strict; use warnings; -my ( %final_class_seen, %stats ); +my ( %final_class_seen, %memoized_cache_objects, %stats ); +my %valid_config_keys = + map { ( $_, 1 ) } qw(defaults memoize_cache_objects namespace storage); sub logger { warn "CHI now uses Log::Any for logging - see Log::Any documentation for details"; } +sub config { + my $class = shift; + $class->_set_config(@_) if @_; + return $class->_get_config(); +} + +sub _set_config { + my ( $class, $config ) = @_; + if ( my @bad_keys = grep { !$valid_config_keys{$_} } keys(%$config) ) { + croak "unknown keys in config hash: " . join( ", ", @bad_keys ); + } + $class->meta->add_method( '_get_config' => sub { $config } ); +} + +CHI->config( {} ); + +sub memoized_cache_objects { + my ($class) = @_; + + # Each CHI root class gets its hash of memoized objects + # + $memoized_cache_objects{$class} ||= {}; + return $memoized_cache_objects{$class}; +} + +sub clear_memoized_cache_objects { + my ($class) = @_; + + $memoized_cache_objects{$class} = {}; +} + sub stats { my ($class) = @_; @@ -27,6 +61,41 @@ sub new { my ( $chi_root_class, %params ) = @_; + my $config = $chi_root_class->config; + + # Cache object memoization: See if cache object with these parameters + # has already been created, and return it if so. Only for parameters + # with 0 or 1 keys. + # + my ( $cache_object_key, $cache_objects ); + if ( $config->{memoize_cache_objects} && keys(%params) <= 1 ) { + $cache_object_key = join chr(28), %params; + $cache_objects = $chi_root_class->memoized_cache_objects; + if ( my $cache_object = $cache_objects->{$cache_object_key} ) { + return $cache_object; + } + } + + # Gather defaults + # + my $core_defaults = $config->{defaults} || {}; + my $namespace_defaults = + $config->{namespace}->{ $params{namespace} || 'Default' } || {}; + my $storage = + $params{storage} + || $namespace_defaults->{storage} + || $core_defaults->{storage}; + my $storage_defaults = {}; + if ( defined($storage) ) { + $storage_defaults = $config->{storage}->{$storage} + or croak "no config for storage type '$storage'"; + } + + # Combine passed params with defaults + # + %params = + ( %$core_defaults, %$storage_defaults, %$namespace_defaults, %params ); + # Get driver class from driver or driver_class parameters # my $driver_class; @@ -74,11 +143,21 @@ $meta->add_method( 'meta' => sub { $meta } ) if !$final_class_seen{$final_class}++; - return $final_class->new( + # Finally create the object + # + my $cache_object = $final_class->new( chi_root_class => $chi_root_class, driver_class => $driver_class, %params ); + + # Memoize if appropriate + # + if ($cache_object_key) { + $cache_objects->{$cache_object_key} = $cache_object; + } + + return $cache_object; } 1; @@ -93,7 +172,7 @@ =head1 VERSION -version 0.50 +version 0.52 =head1 SYNOPSIS @@ -186,9 +265,18 @@ =head1 CONSTRUCTOR -To create a new cache handle, call CHI-E<gt>new. It takes the following common -options. All are optional, except that either I<driver> or I<driver_class> must -be passed. +To create a new cache object, call C<<CHI-E<gt>new>. It takes the common +options listed below. All are optional, except that either I<driver> or +I<driver_class> must be passed. + +Some drivers will take additional constructor options. For example, the File +driver takes C<root_dir> and C<depth> options. + +You can configure default options for each new cache object created - see +L</SUBCLASSING AND CONFIGURING CHI>. + +Note that C<CHI-E<gt>new> returns an instance of a subclass of +L<CHI::Driver|CHI::Driver>, not C<CHI>. =over @@ -368,9 +456,6 @@ =back -Some drivers will take additional constructor options. For example, the File -driver takes C<root_dir> and C<depth> options. - =head1 INSTANCE METHODS The following methods can be called on any cache handle returned from @@ -672,6 +757,11 @@ =over +=item chi_root_class( ) + +Returns the name of the root class under which this object was created, e.g. +C<CHI> or C<My::CHI>. See L</SUBCLASSING AND CONFIGURING CHI>. + =item driver_class( ) Returns the full name of the driver class. e.g. @@ -809,7 +899,7 @@ my $cache = CHI->new( driver => 'Memcached', servers => [ "10.0.0.15:11211", "10.0.0.15:11212" ], - l1_cache => { driver => 'Memory' } + l1_cache => { driver => 'Memory', global => 1, max_size => 1024*1024 } ); On a C<get>, the L1 cache is checked first - if a valid value exists, it is @@ -925,7 +1015,7 @@ l1_cache => { driver => 'File', root_dir => '/path/to/root', - l1_cache => { driver => 'RawMemory' } + l1_cache => { driver => 'RawMemory', global => 1 } } ); @@ -1018,6 +1108,184 @@ L<CHI::Driver::File|File> - there is a race condition in the updating of size that can cause the size to grow inaccurate over time. +=head1 SUBCLASSING AND CONFIGURING CHI + +You can subclass CHI for your own application and configure it in a variety of +ways, e.g. pre-defining storage types and defaults for new cache objects. Your +configuration will be independent of the main CHI class and other CHI +subclasses. + +Start with a trivial subclass: + + package My::CHI; + use base qw(CHI); + 1; + +Then, just use your subclass in place of CHI: + + my $cache = My::CHI->new( ... ); + + print $cache->chi_root_class; + ==> 'My::CHI' + +This obviously doesn't change any behavior by itself. Here's an example with +actual config: + + package My::CHI; + use base qw(CHI); + + __PACKAGE__->config({ + storage => { + local_file => { driver => 'File', root_dir => '/my/root' }, + memcached => { + driver => 'Memcached::libmemcached', + servers => [ '10.0.0.15:11211', '10.0.0.15:11212' ] + }, + }, + namespace => { + 'Foo' => { storage => 'local_file' }, + 'Bar' => { storage => 'local_file', depth => 3 }, + 'Baz' => { storage => 'memcached' }, + } + defaults => { storage => 'local_file' }, + memoize_cache_objects => 1, + }); + + 1; + +Each of these config keys is explained in the next section. + +=head2 Configuration keys + +=over + +=item storage + +A map of names to parameter hashrefs. This provides a way to encapsulate common +sets of parameters that might be used in many caches. e.g. if you define + + storage => { + local_file => { driver => 'File', root_dir => '/my/root' }, + ... + } + +then + + my $cache = My::CHI->new + (namespace => 'Foo', storage => 'local_file'); + +is equivalent to + + my $cache = My::CHI->new + (namespace => 'Foo', driver => 'File', root_dir => '/my/root'); + +=item namespace + +A map of namespace names to parameter hashrefs. When you create a cache object +with the specified namespace, the hashref of parameters will be applied as +defaults. e.g. if you define + + namespace => { + 'Foo' => { driver => 'File', root_dir => '/my/root' }, + 'Bar' => { storage => 'database' }, + ... + } + +then + + my $cache1 = My::CHI->new + (namespace => 'Foo'); + my $cache2 = My::CHI->new + (namespace => 'Bar'); + +is equivalent to + + my $cache1 = My::CHI->new + (namespace => 'Foo', driver => 'File', root_dir => '/my/root'); + my $cache2 = My::CHI->new + (namespace => 'Bar', storage => 'database'); + +=item defaults + +A hash of parameters that will be used as core defaults for all cache objects +created under this root class. e.g. + + defaults => { + on_get_error => 'die', + expires_variance => 0.2, + } + +These can be overriden by namespace defaults, storage settings, or C<new> +parameters. + +=item memoize_cache_objects + +True or false, indicates whether C<My::CHI-E<gt>new> should memoize and return +the same cache object if given the same parameters. This can speed things up if +you create cache objects frequently. Will currently only work for 0- or 1- key +parameter hashes. e.g. + + My::CHI->config({ + memoize_cache_objects => 1, + }); + +then + + # $cache1 and $cache2 will be the same object, regardless of what + # namespace and storage defaults are associated with 'Foo' + # + my $cache1 = My::CHI->new(namespace => 'Foo'); + my $cache2 = My::CHI->new(namespace => 'Foo'); + + # $cache3 and $cache4 will be different objects + # + my $cache3 = My::CHI->new + (namespace => 'Bar', driver => 'File', root_dir => '/my/root'); + my $cache4 = My::CHI->new + (namespace => 'Bar', driver => 'File', root_dir => '/my/root'); + +To clear the memoized cache objects, call + + My::CHI->clear_memoized_cache_objects; + +=back + +=head2 How defaults are combined + +Defaults are applied in the following order, from highest to lowest precedence: + +=over + +=item * + +Parameters passed in C<new> + +=item * + +Namespace defaults, if any + +=item * + +Storage settings, if any + +=item * + +Core defaults defined under 'defaults' + +=back + +=head2 Inheritance of config + +A subclass will automatically inherit the configuration of its parent if it +does not call C<config> itself (ala +L<Class::Data::Inheritable|Class::Data::Inheritable>). + +=head2 Reading config from a file + + use YAML::XS qw(LoadFile); + + __PACKAGE__->config(LoadFile("/path/to/cache.yml")); + =for readme continue =head1 AVAILABILITY OF DRIVERS @@ -1033,7 +1301,7 @@ =item * L<CHI::Driver::RawMemory|CHI::Driver::RawMemory> - In-process memory based -cache that stores references directly instead of deep-copying +cache that stores references directly instead of serializing/deep-copying =item * @@ -1183,7 +1451,8 @@ =item Serialization CHI handles its own serialization, passing a flat binary string to the -underlying cache backend. +underlying cache backend. The notable exception is +L<CHI::Driver::RawMemory|CHI::Driver::RawMemory> which does no serialization. =item Expiration diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHI-0.50/t/Config.t new/CHI-0.52/t/Config.t --- old/CHI-0.50/t/Config.t 1970-01-01 01:00:00.000000000 +0100 +++ new/CHI-0.52/t/Config.t 2012-03-08 08:58:09.000000000 +0100 @@ -0,0 +1,3 @@ +#!perl -w +use CHI::t::Config; +CHI::t::Config->runtests; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
