New Upstream Snapshot - libchi-perl
Ready changes
Summary
Merged new upstream version: 0.241+git20220107.1.4e59ee1 (was: 0.61).
Resulting package
Built on 2022-10-14T15:18 (took 7m35s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots libchi-perl
Lintian Result
Diff
diff --git a/Changes b/Changes
index 034145f..e13a3e8 100644
--- a/Changes
+++ b/Changes
@@ -1,486 +1,491 @@
-Revision history for CHI
-
-** denotes an incompatible change
-
-0.61 Oct 13, 2021
-
-* Fixes
- - Unescaped left brace in regex is deprecated - RT #125596, #115022
- - Missing dependency on Module::Mask - RT #114665
-
-* Tests
- - Added continuous integration (CI) via GitHub Actions
-
-* Docs
- - improved POD
-
-0.60 Jun 7, 2015
-
-* Fixes
- - Switch JSON backends from JSON.pm to JSON::MaybeXS - https://github.com/jonswar/perl-chi/pull/20 (Karen Etheridge)
-
-0.59 Jan 7, 2015
-
-* Improvements
- - Pass driver to expire_if - https://github.com/jonswar/perl-chi/pull/19 (rouzier)
-
-* Fixes
- - Fix DiscardPolicy type - RT #95291 (Josh Rosenbaum)
- - Don't mandate that get_namespaces returns in same order - RT #89892 (nhorne)
-
-0.58 May 18, 2014
-
-* Implementation
- - Use Moo instead of Moose for object system. This should be fully compatible
- with existing code, including Moose drivers or other extensions. This
- reduces the startup time and memory overhead.
-
-* Improvements
- - The Memory and RawMemory drivers now support zero as a valid value for
- the global argument causing a new hashref datastore to be created. (Aran
- Deltac)
-
-* Fixes
- - Fix busted packaging
- - Fix the loading of additional roles or traits (jrouzierinverse)
-
-0.57 Jan 26, 2014
-
-* Improvements
- - Use nfreeze instead of freeze for network portability - RT #74188 (Jeffrey Fuller)
-
-0.56 Oct 22, 2012
-
-* Fixes
- - Mention testing_driver_class in CHI/Driver/Development.pm - RT #78921 (Nigel Horne)
-
-* Tests
- - Add test_multiple_processes for testing drivers under concurrent writes - RT #79132 (Nigel Horne)
-
-* Docs
- - Mention that driver tests are responsible for their own cleanup - RT #79100 (Nigel Horne)
- - Various spelling fixes thanks to Pod::Spell
-
-0.55 Jul 3, 2012
-
-* Improvements
- - Compute derived/aggregate stats in CHI::Stats::parse_stats_logs
-
-* Fixes
- - Eliminate "=for html" POD entries, which were mangling metacpan.org output (Pedro Melo)
-
-0.54 May 30, 2012
-
-** Incompatible Changes **
- - ** Switch CHI::Stats format to JSON for easier generation and parsing
-
-0.53 May 30, 2012
-
-* Improvements
- - Measure time elapsed in get, set, and compute; record in logs and stats. Only
- measure when debug logging or stats are enabled.
- - compute() now handles list or scalar caller context
- - The driver parameter now accepts full classes prefixed by '+', as is standard.
- driver_class is still accepted for backward compatibility but no longer documented.
-
-* Fixes
- - compute() no longer modifies passed-in options hashref
- - Fix get_multi_* with partially empty l1 cache - perl-chi/pull/12 (Mike Cartmell)
- - Fix get_keys when file_extension set on CHI::Driver::File - RT #76489 (Vitaliy Tokarev)
- - Have set_multi call store_multi underneath as documented in Development.pod - RT
- #76621 (Oliver Paukstadt)
- - Minor POD fixes (Alessandro Ghedini)
-
-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
- - Clarify busy_lock doc, add obj_ref doc (perlover)
-
-* Fixes
- - Override set() rather than set_object() in Role/HasSubcaches.pm so that
- keys are not double-transformed when set in l1 or mirror caches. This is
- simpler and should be more robust.
- - Remove htdocs which were accidentally added into dist
-
-0.49 Jun 23, 2011
-
-* Fixes
- - Go back to generating version numbers for all sub-modules again
-
-0.48 Jun 15, 2011
-
-* Fixes
- - Disregard default expires_at and expires_in if either are provided - RT #67970 (spjw)
-
-0.47 Apr 28, 2011
-
-* Improvements
- - Allow compute() to take get options - expire_if and busy_lock
- - Add atomic operations: add, append, replace (alpha)
-
-0.46 Apr 22, 2011
-
-* Other
- - Only generate version numbers for .pm files with documentation, to reduce inter-version churn
-
-0.45 Apr 18, 2011
-
-* Improvements
- - Add expires_on_backend parameter
-
-0.44 Mar 17, 2011
-
-* Fixes
- - Recreate tarball so that it can be read with older tars
- - Remove more unnecessary packages from CPAN index
-
-0.43 Mar 17, 2011
-
-* Improvements
- - Add compress_threshold parameter
-
-0.42 Mar 3, 2011
-
-* Fixes
- - Put parens around qw in various places to fix for perl 5.13+
-
-* Improvements
- - Improve accuracy of benchmarks (nothingmuch)
-
-0.41 Mar 1, 2011
-
-* Improvements
- - Add RawMemory driver, a faster version of Memory that does not serialize/deserialize
- values
- - Add etc/bench/bench.pl for benchmarking CHI and non-CHI caches
- - Publish current benchmarking results in CHI::Benchmarks
-
-* Testing
- - Stop using test counts (http://stackoverflow.com/questions/690342/)
-
-0.40 Feb 27, 2011
-
-* Improvements
- - Reverse order of 2nd and 3rd arguments in compute() (old order will still work)
- - Throw error if arguments passed to clear()
-
-* Fixes
- - Fix CHI::Driver::Metacache::meta_cache to build lazily, eliminating intermittent bug
- and making compatible with Moose 1.99+ (autarch)
- - Check if get_object defined in purge - RT #63699 (forrest)
-
-0.39 Feb 6, 2011
-
-* Fixes
- - Put missing module names back in POD
-
-0.38 Feb 6, 2011
-
-* Fixes
- - Move some smoke tests back to author tests
-
-0.37 Feb 6, 2011
-
-* Fixes
- - Eliminate Module::Load::Conditional which was causing problems with version.pm - RT
- #64900 - reported by dgl@dgl.cx
-
-* Implementation
- - Switch to Dist::Zilla
-
-0.36 Jun 9, 2010
-
-* Fixes
- - Only encode keys with wide characters
- - In escape_for_filename, replace \w with A-Za-z0-9_ to avoid The Unicode Bug
-
-0.35 Jun 4, 2010
-
-* Improvements
- - Automatically serialize keys that are references
- - Automatically digest long keys, based on max_key_length and key_digester
- - Handle utf-8 characters in keys and values
-
-* Fixes
- - Add Test::Builder and Test::Log::Dispatch to dependencies - RT #57091 - reported by Doug Bell
- - Add line about installing Cache::FastMmap in CHI::Driver::FastMmap - RT #55920 - reported by RSAVAGE
-
-0.34 Feb 9, 2010
-
-* Improvements
- - Add statistics recording with CHI::Stats
- - Add max_build_depth to ward off accidental infinite subcache recursion
-
-* Fixes
- - Change unique_id so as not to seg fault with threads - RT #53591 - reported by Marc Tobias
- - Eliminate existence check in File remove(), as it is prone to race condition - RT #50104 - reported by Aran Deltac
- - In File clear(), rename directory before removing to reduce chance of conflict
-
-0.33 Nov 29, 2009
-
-* Fixes
- - In CacheContainer, ensure that fetch returns scalar
- - Include Role::IsSubcache attributes in CHI::Driver->non_common_constructor_params
-
-0.32 Nov 24, 2009
-
-* Fixes
- - get_keys not supported in File driver when key_digest is used, for now
- - Replace deprecated Class::MOP get_attribute_map with get_attribute_list - RT #52019 -
- reported by Todd Caine
- - Include Role::HasSubcaches and Role::IsSizeAware attributes in
- CHI::Driver->non_common_constructor_params
-
-0.31 Nov 17, 2009
-
-* Improvements
- - ** Rename file_digest to key_digest, so it can be made a generic driver feature later on
- - Allow key_digest to be passed as a string, hash or object
- - Create Digest object once per CHI object, rather than once per read/write
-
-0.30 Nov 5, 2009
-
-* Fixes
- - Fix bug with size-aware L1 cache not keeping track of size
- - Fix description of never-expiring set in logs and errors
-
-* Improvements
- - Add file_digest and file_extension options to File driver
- - Improve l1 cache performance by reusing packed CacheObject data
- - Document options that cannot be overriden by subcache, and warn if user tries to override these
-
-0.29 Oct 14, 2009
-
-* Fixes
- - Make sure Memory cache is cleared when multiple objects use the same datastore, or when datastore hash itself is emptied
- - Fix synopsis of Memory cache in main docs - RT #50360 - reported by zloyrusskiy
- - Fix get_namespaces when File root dir doesn't exist
- - Fix tests to use label for log matching
-
-0.28 Aug 31, 2009
-
-* Fixes
- - Add Test::Exception, Log::Any::Adapter::Dispatch to dependencies
- - Remove use of no-longer-existent CHI::Test::Logger from test modules - RT #49252
- - Fix get_multi_* when $@ already contains an error - RT #48988 - reported by Sergey Panteleev
- - Fix docs to mention root_dir - RT #43409 - reported by anirvan
-
-* Implementation
- - Remove private debugging methods dp and dps
-
-0.27 Aug 27, 2009
-
-** Incompatible Changes **
- - ** Switch to using Log::Any for controlling logging, instead of custom CHI->logger()
-
-* Implementation
- - Move internal tests to xt/release, as per standard
-
-0.26 Jul 14, 2009
-
-* Fixes
- - Eliminate is_subcache redefinition of attribute (causes CHI to fail to load under latest Moose)
-
-* Implementation
- - Make sure that tests are only using keys from a particular list; this is necessary for
- memcached tests, which has to simulate get_keys by checking for all the possible ones
-
-0.25 Jun 2, 2009
-
-* Improvements
- - Non-Moose drivers should be fully functional again (reversing the change in 0.23)
-
-* Implementation
- - Moved role composition to CHI.pm factory (ala MooseX::Traits), so that each role can have its
- own attributes and initialization
- - Moved all Moose types to CHI::Types
- - Replaced require_dynamic with Class::MOP::load_class
-
-0.241 May 26, 2009
-
-* Fixes
- - Actually add Moose to requirements, in place of Any::Moose
-
-0.24 May 26, 2009
-
-* Fixes
- - Reverted test scripts to previous format, as they were causing problems with other
- driver distributions
-
-0.23 May 24, 2009
-
-** Incompatible Changes **
- - ** Drivers must now be Moose based to be fully functional, since we use Moose roles to
- implement various features. For backward compatibility, non-Moose drivers will still work
- at a basic level (for now).
-
-* Improvements
- - Added concepts of size awareness, maximum size, and discard policies for any driver.
- See "Size Awareness" section of docs.
-
-* Implementation
- - Added a metacache, which resides in a separate _CHI_META namespace and stores meta-information
- about caches. Initially for tracking size for size-aware caches.
- - Added dependency on Carp::Assert
- - Eliminate boilerplate in test scripts
-
-* Fixes
- - Croak if specify both 'global' and 'datastore' for memory driver
-
-0.22 May 13, 2009
-
-* Implementation
- - Switch from Mouse back to Moose - six week experiment over. Once we started using roles,
- Mouse became increasingly unattractive and the Moose community encouraged us not to go
- further with it. We can hope (or help ensure) that Moose installation and startup time improves.
- - Moved subcache code to a separate role, CHI::Driver::Role::HasSubcaches. API remains
- the same -- activated via l1_cache and mirror_cache options to CHI->new.
-
-0.21 May 5, 2009
-
-** Incompatible Changes **
- - ** Deprecate get_multi_array - silly to have this along with get_multi_arrayref
- - ** CHI::Driver::Memory will no longer use a global datastore by default - it was too easy
- to accidentally share the same datstore in unrelated code. Either a datastore or the
- 'global' flag must be specified. Right now the absence of either will issue a warning,
- eventually this may become an error.
-
-* Improvements
- - To implement get_multi_*, drivers now define the simpler fetch_multi_hashref
- - Made get_multi_* work optimally with l1 caches
-
-* Fixes
- - Eliminated t/Multilevel.t which was causing test failures on new installations
- - Fixed get_namespaces for File driver to ignore non-standard dir names
-
-* Docs
- - Tidied pod with Pod::Tidy
- - Added Features section and mention of Chris Leishman's Cache to docs
-
-0.2 Apr 25, 2009
-
-** Incompatibile Changes **
- - ** Removed CHI::Driver::Multilevel, replaced with subcaches
- - ** ref($driver) is no longer simply the driver class, it is an auto-generated wrapper
- class like CHI::Wrapped::CHI::Driver::Memory - this is so that certain driver methods
- can be automatically wrapped
-
-* Improvements
- - Added a more practical and intuitive multi-level cache mechanism: subcaches. l1_cache
- and mirror_cache are the first two supported subcaches
- - Added customizable cache label, used in logs and error messages
-
-0.102 Mar 6, 2009
-
-* Fixes
- - Skip get_namespaces in tests with drivers that don't support it
- - Eliminate unconditional use of Data::Serializer in tests; improve error when Data::Serializer not installed
-
-0.101 Mar 2, 2009
-
-* Fixes
- - Don't use Data::Serializer up front
-
-0.10 Feb 28, 2009
-
-- ** Deprecate expire_if method - this can easily be done manually, and it now differs
- deceptively from the expire_if option to get()
-- ** Change expire_if option to simply return undef, without actually expiring the item
-- Switch to Mouse instead of Moose, to reduce install dependencies and overhead. Eliminate
- Moose-isms as needed. Eventually may switch to Any::Moose but want to get comfortable
- with Mouse first.
-- Eliminate dependencies on Data::Serializer, File::Slurp, and Module::Find
-- Revert Memory driver implementation to more readable and illustrative form
-- Handle value-too-large errors in FastMmap driver
-- When serializer passed as a string, use raw=>1 so as not to hex-encode or insert token
-- Allow serializer to be passed as a hashref
-- Fix bug when specifying serializer with multilevel driver
-
-0.091 Jan 2, 2009
-
-- Ensure that unlink_on_exit=0 is being passed to FastMmap
-- Allow serializer to be passed as a simple string
-- Documentation fixes
-
-0.09 Dec 30, 2008
-
-- Moved source to git
-- Added Null driver
-- Fixed main docs regarding Memcached driver
-- Changed FastMmap driver to pass all unrecognized options onto Cache::FastMmap, to better
- handle future FastMmap versions
-- Fixed small get_keys bug in File driver
-- Added expires time to set logs
-- Added get_multi_array alongside get_multi_arrayref
-- Added test for get_namespaces
-
-0.081 Sep 24, 2008
-
-- Fix t/Driver/File.pm test so it does not depend on specific OS error message
-
-0.08 Sep 23, 2008
-
-- ** Move CHI::Driver::Memcached to its own distribution
-- Many internal changes to make greater use of Moose (Dave Rolsky).
-- Add serializer option, allowing control over how data is serialized/deserialized
-- The FastMmap driver was not actually making use of the init_file,
- cache_size, page_size, or num_pages options. Reported by Mike
- Astle. RT #35819. (Dave Rolsky)
-- Allow suppression of renames in CHI::Driver::File by overriding
- generate_temporary_filename
-
-0.07 Mar 12, 2008
-
-- Add Date::Parse to build dependencies
-
-0.06 Feb 29, 2008
-
-- Created separate manual for developing drivers (CHI::Driver::Development)
-- Made standard CHI driver tests easily available to external drivers
-- Fixed clear() in Memcached driver - RT #32859 - reported by Justin Ellison
-- Add size to set logs
-
-0.05 Jan 30, 2008
-
-- Switched to Moose
-- Added maximum full path length check to File driver, mainly for MSWin32
-- Added TODO to pod
-
-0.04 Jan 25, 2008
-
-- Default unlink_on_exit to 0 for Cache::FastMmap to conform to the CHI API
-
-0.03 Jan 23, 2008
-
-- ** Eliminated automatic namespace selection based on caller; namespace now defaults to
- 'Default', as in Cache::Cache.
-- Added 5.6.0 requirement
-- Made Memcached test internal-only for now, since test success depends on presence and
- configuration of an external server
-- Changed README to generate from CHI.pm
-
-0.02 Jan 19, 2008
-
-- Changed Multilevel-Single test to use a temporary root dir
-- Eliminated non-portable file permissions test
-- Concealed use of test package name (Foo::Bar) from PAUSE indexer
-
-0.01 Jan 15, 2008
-
-- Initial version
+Revision history for CHI
+
+** denotes an incompatible change
+
+0.62
+
+* Improvements
+ - Replace List::MoreUtils with List::Util to reduce dependencies - PR #34
+
+0.61 Oct 13, 2021
+
+* Fixes
+ - Unescaped left brace in regex is deprecated - RT #125596, #115022
+ - Missing dependency on Module::Mask - RT #114665
+
+* Tests
+ - Added continuous integration (CI) via GitHub Actions
+
+* Docs
+ - improved POD
+
+0.60 Jun 7, 2015
+
+* Fixes
+ - Switch JSON backends from JSON.pm to JSON::MaybeXS - https://github.com/jonswar/perl-chi/pull/20 (Karen Etheridge)
+
+0.59 Jan 7, 2015
+
+* Improvements
+ - Pass driver to expire_if - https://github.com/jonswar/perl-chi/pull/19 (rouzier)
+
+* Fixes
+ - Fix DiscardPolicy type - RT #95291 (Josh Rosenbaum)
+ - Don't mandate that get_namespaces returns in same order - RT #89892 (nhorne)
+
+0.58 May 18, 2014
+
+* Implementation
+ - Use Moo instead of Moose for object system. This should be fully compatible
+ with existing code, including Moose drivers or other extensions. This
+ reduces the startup time and memory overhead.
+
+* Improvements
+ - The Memory and RawMemory drivers now support zero as a valid value for
+ the global argument causing a new hashref datastore to be created. (Aran
+ Deltac)
+
+* Fixes
+ - Fix busted packaging
+ - Fix the loading of additional roles or traits (jrouzierinverse)
+
+0.57 Jan 26, 2014
+
+* Improvements
+ - Use nfreeze instead of freeze for network portability - RT #74188 (Jeffrey Fuller)
+
+0.56 Oct 22, 2012
+
+* Fixes
+ - Mention testing_driver_class in CHI/Driver/Development.pm - RT #78921 (Nigel Horne)
+
+* Tests
+ - Add test_multiple_processes for testing drivers under concurrent writes - RT #79132 (Nigel Horne)
+
+* Docs
+ - Mention that driver tests are responsible for their own cleanup - RT #79100 (Nigel Horne)
+ - Various spelling fixes thanks to Pod::Spell
+
+0.55 Jul 3, 2012
+
+* Improvements
+ - Compute derived/aggregate stats in CHI::Stats::parse_stats_logs
+
+* Fixes
+ - Eliminate "=for html" POD entries, which were mangling metacpan.org output (Pedro Melo)
+
+0.54 May 30, 2012
+
+** Incompatible Changes **
+ - ** Switch CHI::Stats format to JSON for easier generation and parsing
+
+0.53 May 30, 2012
+
+* Improvements
+ - Measure time elapsed in get, set, and compute; record in logs and stats. Only
+ measure when debug logging or stats are enabled.
+ - compute() now handles list or scalar caller context
+ - The driver parameter now accepts full classes prefixed by '+', as is standard.
+ driver_class is still accepted for backward compatibility but no longer documented.
+
+* Fixes
+ - compute() no longer modifies passed-in options hashref
+ - Fix get_multi_* with partially empty l1 cache - perl-chi/pull/12 (Mike Cartmell)
+ - Fix get_keys when file_extension set on CHI::Driver::File - RT #76489 (Vitaliy Tokarev)
+ - Have set_multi call store_multi underneath as documented in Development.pod - RT
+ #76621 (Oliver Paukstadt)
+ - Minor POD fixes (Alessandro Ghedini)
+
+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
+ - Clarify busy_lock doc, add obj_ref doc (perlover)
+
+* Fixes
+ - Override set() rather than set_object() in Role/HasSubcaches.pm so that
+ keys are not double-transformed when set in l1 or mirror caches. This is
+ simpler and should be more robust.
+ - Remove htdocs which were accidentally added into dist
+
+0.49 Jun 23, 2011
+
+* Fixes
+ - Go back to generating version numbers for all sub-modules again
+
+0.48 Jun 15, 2011
+
+* Fixes
+ - Disregard default expires_at and expires_in if either are provided - RT #67970 (spjw)
+
+0.47 Apr 28, 2011
+
+* Improvements
+ - Allow compute() to take get options - expire_if and busy_lock
+ - Add atomic operations: add, append, replace (alpha)
+
+0.46 Apr 22, 2011
+
+* Other
+ - Only generate version numbers for .pm files with documentation, to reduce inter-version churn
+
+0.45 Apr 18, 2011
+
+* Improvements
+ - Add expires_on_backend parameter
+
+0.44 Mar 17, 2011
+
+* Fixes
+ - Recreate tarball so that it can be read with older tars
+ - Remove more unnecessary packages from CPAN index
+
+0.43 Mar 17, 2011
+
+* Improvements
+ - Add compress_threshold parameter
+
+0.42 Mar 3, 2011
+
+* Fixes
+ - Put parens around qw in various places to fix for perl 5.13+
+
+* Improvements
+ - Improve accuracy of benchmarks (nothingmuch)
+
+0.41 Mar 1, 2011
+
+* Improvements
+ - Add RawMemory driver, a faster version of Memory that does not serialize/deserialize
+ values
+ - Add etc/bench/bench.pl for benchmarking CHI and non-CHI caches
+ - Publish current benchmarking results in CHI::Benchmarks
+
+* Testing
+ - Stop using test counts (http://stackoverflow.com/questions/690342/)
+
+0.40 Feb 27, 2011
+
+* Improvements
+ - Reverse order of 2nd and 3rd arguments in compute() (old order will still work)
+ - Throw error if arguments passed to clear()
+
+* Fixes
+ - Fix CHI::Driver::Metacache::meta_cache to build lazily, eliminating intermittent bug
+ and making compatible with Moose 1.99+ (autarch)
+ - Check if get_object defined in purge - RT #63699 (forrest)
+
+0.39 Feb 6, 2011
+
+* Fixes
+ - Put missing module names back in POD
+
+0.38 Feb 6, 2011
+
+* Fixes
+ - Move some smoke tests back to author tests
+
+0.37 Feb 6, 2011
+
+* Fixes
+ - Eliminate Module::Load::Conditional which was causing problems with version.pm - RT
+ #64900 - reported by dgl@dgl.cx
+
+* Implementation
+ - Switch to Dist::Zilla
+
+0.36 Jun 9, 2010
+
+* Fixes
+ - Only encode keys with wide characters
+ - In escape_for_filename, replace \w with A-Za-z0-9_ to avoid The Unicode Bug
+
+0.35 Jun 4, 2010
+
+* Improvements
+ - Automatically serialize keys that are references
+ - Automatically digest long keys, based on max_key_length and key_digester
+ - Handle utf-8 characters in keys and values
+
+* Fixes
+ - Add Test::Builder and Test::Log::Dispatch to dependencies - RT #57091 - reported by Doug Bell
+ - Add line about installing Cache::FastMmap in CHI::Driver::FastMmap - RT #55920 - reported by RSAVAGE
+
+0.34 Feb 9, 2010
+
+* Improvements
+ - Add statistics recording with CHI::Stats
+ - Add max_build_depth to ward off accidental infinite subcache recursion
+
+* Fixes
+ - Change unique_id so as not to seg fault with threads - RT #53591 - reported by Marc Tobias
+ - Eliminate existence check in File remove(), as it is prone to race condition - RT #50104 - reported by Aran Deltac
+ - In File clear(), rename directory before removing to reduce chance of conflict
+
+0.33 Nov 29, 2009
+
+* Fixes
+ - In CacheContainer, ensure that fetch returns scalar
+ - Include Role::IsSubcache attributes in CHI::Driver->non_common_constructor_params
+
+0.32 Nov 24, 2009
+
+* Fixes
+ - get_keys not supported in File driver when key_digest is used, for now
+ - Replace deprecated Class::MOP get_attribute_map with get_attribute_list - RT #52019 -
+ reported by Todd Caine
+ - Include Role::HasSubcaches and Role::IsSizeAware attributes in
+ CHI::Driver->non_common_constructor_params
+
+0.31 Nov 17, 2009
+
+* Improvements
+ - ** Rename file_digest to key_digest, so it can be made a generic driver feature later on
+ - Allow key_digest to be passed as a string, hash or object
+ - Create Digest object once per CHI object, rather than once per read/write
+
+0.30 Nov 5, 2009
+
+* Fixes
+ - Fix bug with size-aware L1 cache not keeping track of size
+ - Fix description of never-expiring set in logs and errors
+
+* Improvements
+ - Add file_digest and file_extension options to File driver
+ - Improve l1 cache performance by reusing packed CacheObject data
+ - Document options that cannot be overriden by subcache, and warn if user tries to override these
+
+0.29 Oct 14, 2009
+
+* Fixes
+ - Make sure Memory cache is cleared when multiple objects use the same datastore, or when datastore hash itself is emptied
+ - Fix synopsis of Memory cache in main docs - RT #50360 - reported by zloyrusskiy
+ - Fix get_namespaces when File root dir doesn't exist
+ - Fix tests to use label for log matching
+
+0.28 Aug 31, 2009
+
+* Fixes
+ - Add Test::Exception, Log::Any::Adapter::Dispatch to dependencies
+ - Remove use of no-longer-existent CHI::Test::Logger from test modules - RT #49252
+ - Fix get_multi_* when $@ already contains an error - RT #48988 - reported by Sergey Panteleev
+ - Fix docs to mention root_dir - RT #43409 - reported by anirvan
+
+* Implementation
+ - Remove private debugging methods dp and dps
+
+0.27 Aug 27, 2009
+
+** Incompatible Changes **
+ - ** Switch to using Log::Any for controlling logging, instead of custom CHI->logger()
+
+* Implementation
+ - Move internal tests to xt/release, as per standard
+
+0.26 Jul 14, 2009
+
+* Fixes
+ - Eliminate is_subcache redefinition of attribute (causes CHI to fail to load under latest Moose)
+
+* Implementation
+ - Make sure that tests are only using keys from a particular list; this is necessary for
+ memcached tests, which has to simulate get_keys by checking for all the possible ones
+
+0.25 Jun 2, 2009
+
+* Improvements
+ - Non-Moose drivers should be fully functional again (reversing the change in 0.23)
+
+* Implementation
+ - Moved role composition to CHI.pm factory (ala MooseX::Traits), so that each role can have its
+ own attributes and initialization
+ - Moved all Moose types to CHI::Types
+ - Replaced require_dynamic with Class::MOP::load_class
+
+0.241 May 26, 2009
+
+* Fixes
+ - Actually add Moose to requirements, in place of Any::Moose
+
+0.24 May 26, 2009
+
+* Fixes
+ - Reverted test scripts to previous format, as they were causing problems with other
+ driver distributions
+
+0.23 May 24, 2009
+
+** Incompatible Changes **
+ - ** Drivers must now be Moose based to be fully functional, since we use Moose roles to
+ implement various features. For backward compatibility, non-Moose drivers will still work
+ at a basic level (for now).
+
+* Improvements
+ - Added concepts of size awareness, maximum size, and discard policies for any driver.
+ See "Size Awareness" section of docs.
+
+* Implementation
+ - Added a metacache, which resides in a separate _CHI_META namespace and stores meta-information
+ about caches. Initially for tracking size for size-aware caches.
+ - Added dependency on Carp::Assert
+ - Eliminate boilerplate in test scripts
+
+* Fixes
+ - Croak if specify both 'global' and 'datastore' for memory driver
+
+0.22 May 13, 2009
+
+* Implementation
+ - Switch from Mouse back to Moose - six week experiment over. Once we started using roles,
+ Mouse became increasingly unattractive and the Moose community encouraged us not to go
+ further with it. We can hope (or help ensure) that Moose installation and startup time improves.
+ - Moved subcache code to a separate role, CHI::Driver::Role::HasSubcaches. API remains
+ the same -- activated via l1_cache and mirror_cache options to CHI->new.
+
+0.21 May 5, 2009
+
+** Incompatible Changes **
+ - ** Deprecate get_multi_array - silly to have this along with get_multi_arrayref
+ - ** CHI::Driver::Memory will no longer use a global datastore by default - it was too easy
+ to accidentally share the same datstore in unrelated code. Either a datastore or the
+ 'global' flag must be specified. Right now the absence of either will issue a warning,
+ eventually this may become an error.
+
+* Improvements
+ - To implement get_multi_*, drivers now define the simpler fetch_multi_hashref
+ - Made get_multi_* work optimally with l1 caches
+
+* Fixes
+ - Eliminated t/Multilevel.t which was causing test failures on new installations
+ - Fixed get_namespaces for File driver to ignore non-standard dir names
+
+* Docs
+ - Tidied pod with Pod::Tidy
+ - Added Features section and mention of Chris Leishman's Cache to docs
+
+0.2 Apr 25, 2009
+
+** Incompatibile Changes **
+ - ** Removed CHI::Driver::Multilevel, replaced with subcaches
+ - ** ref($driver) is no longer simply the driver class, it is an auto-generated wrapper
+ class like CHI::Wrapped::CHI::Driver::Memory - this is so that certain driver methods
+ can be automatically wrapped
+
+* Improvements
+ - Added a more practical and intuitive multi-level cache mechanism: subcaches. l1_cache
+ and mirror_cache are the first two supported subcaches
+ - Added customizable cache label, used in logs and error messages
+
+0.102 Mar 6, 2009
+
+* Fixes
+ - Skip get_namespaces in tests with drivers that don't support it
+ - Eliminate unconditional use of Data::Serializer in tests; improve error when Data::Serializer not installed
+
+0.101 Mar 2, 2009
+
+* Fixes
+ - Don't use Data::Serializer up front
+
+0.10 Feb 28, 2009
+
+- ** Deprecate expire_if method - this can easily be done manually, and it now differs
+ deceptively from the expire_if option to get()
+- ** Change expire_if option to simply return undef, without actually expiring the item
+- Switch to Mouse instead of Moose, to reduce install dependencies and overhead. Eliminate
+ Moose-isms as needed. Eventually may switch to Any::Moose but want to get comfortable
+ with Mouse first.
+- Eliminate dependencies on Data::Serializer, File::Slurp, and Module::Find
+- Revert Memory driver implementation to more readable and illustrative form
+- Handle value-too-large errors in FastMmap driver
+- When serializer passed as a string, use raw=>1 so as not to hex-encode or insert token
+- Allow serializer to be passed as a hashref
+- Fix bug when specifying serializer with multilevel driver
+
+0.091 Jan 2, 2009
+
+- Ensure that unlink_on_exit=0 is being passed to FastMmap
+- Allow serializer to be passed as a simple string
+- Documentation fixes
+
+0.09 Dec 30, 2008
+
+- Moved source to git
+- Added Null driver
+- Fixed main docs regarding Memcached driver
+- Changed FastMmap driver to pass all unrecognized options onto Cache::FastMmap, to better
+ handle future FastMmap versions
+- Fixed small get_keys bug in File driver
+- Added expires time to set logs
+- Added get_multi_array alongside get_multi_arrayref
+- Added test for get_namespaces
+
+0.081 Sep 24, 2008
+
+- Fix t/Driver/File.pm test so it does not depend on specific OS error message
+
+0.08 Sep 23, 2008
+
+- ** Move CHI::Driver::Memcached to its own distribution
+- Many internal changes to make greater use of Moose (Dave Rolsky).
+- Add serializer option, allowing control over how data is serialized/deserialized
+- The FastMmap driver was not actually making use of the init_file,
+ cache_size, page_size, or num_pages options. Reported by Mike
+ Astle. RT #35819. (Dave Rolsky)
+- Allow suppression of renames in CHI::Driver::File by overriding
+ generate_temporary_filename
+
+0.07 Mar 12, 2008
+
+- Add Date::Parse to build dependencies
+
+0.06 Feb 29, 2008
+
+- Created separate manual for developing drivers (CHI::Driver::Development)
+- Made standard CHI driver tests easily available to external drivers
+- Fixed clear() in Memcached driver - RT #32859 - reported by Justin Ellison
+- Add size to set logs
+
+0.05 Jan 30, 2008
+
+- Switched to Moose
+- Added maximum full path length check to File driver, mainly for MSWin32
+- Added TODO to pod
+
+0.04 Jan 25, 2008
+
+- Default unlink_on_exit to 0 for Cache::FastMmap to conform to the CHI API
+
+0.03 Jan 23, 2008
+
+- ** Eliminated automatic namespace selection based on caller; namespace now defaults to
+ 'Default', as in Cache::Cache.
+- Added 5.6.0 requirement
+- Made Memcached test internal-only for now, since test success depends on presence and
+ configuration of an external server
+- Changed README to generate from CHI.pm
+
+0.02 Jan 19, 2008
+
+- Changed Multilevel-Single test to use a temporary root dir
+- Eliminated non-portable file permissions test
+- Concealed use of test package name (Foo::Bar) from PAUSE indexer
+
+0.01 Jan 15, 2008
+
+- Initial version
diff --git a/MANIFEST b/MANIFEST
index dac593a..ba5a0ec 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.025.
Changes
INSTALL
LICENSE
diff --git a/META.json b/META.json
index cbe85d1..86f6c09 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
"Jonathan Swartz <swartz@pobox.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
+ "generated_by" : "Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
@@ -43,7 +43,7 @@
"File::Spec" : "0.80",
"Hash::MoreUtils" : "0",
"JSON::MaybeXS" : "1.003003",
- "List::MoreUtils" : "0.13",
+ "List::Util" : "1.45",
"Log::Any" : "0.08",
"Moo" : "1.003",
"MooX::Types::MooseLike" : "0.23",
@@ -85,8 +85,8 @@
}
},
"version" : "0.61",
- "x_generated_by_perl" : "v5.30.2",
- "x_serialization_backend" : "Cpanel::JSON::XS version 4.19",
+ "x_generated_by_perl" : "v5.34.0",
+ "x_serialization_backend" : "Cpanel::JSON::XS version 4.32",
"x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
}
diff --git a/META.yml b/META.yml
index 58181ec..05bc1d5 100644
--- a/META.yml
+++ b/META.yml
@@ -15,7 +15,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -41,7 +41,7 @@ requires:
File::Spec: '0.80'
Hash::MoreUtils: '0'
JSON::MaybeXS: '1.003003'
- List::MoreUtils: '0.13'
+ List::Util: '1.45'
Log::Any: '0.08'
Moo: '1.003'
MooX::Types::MooseLike: '0.23'
@@ -58,6 +58,6 @@ resources:
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=CHI
repository: git://github.com/jonswar/perl-chi.git
version: '0.61'
-x_generated_by_perl: v5.30.2
+x_generated_by_perl: v5.34.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
diff --git a/Makefile.PL b/Makefile.PL
index 954be02..1052152 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.025.
use strict;
use warnings;
@@ -24,7 +24,7 @@ my %WriteMakefileArgs = (
"File::Spec" => "0.80",
"Hash::MoreUtils" => 0,
"JSON::MaybeXS" => "1.003003",
- "List::MoreUtils" => "0.13",
+ "List::Util" => "1.45",
"Log::Any" => "0.08",
"Moo" => "1.003",
"MooX::Types::MooseLike" => "0.23",
@@ -67,7 +67,7 @@ my %FallbackPrereqs = (
"File::Spec" => "0.80",
"Hash::MoreUtils" => 0,
"JSON::MaybeXS" => "1.003003",
- "List::MoreUtils" => "0.13",
+ "List::Util" => "1.45",
"Log::Any" => "0.08",
"Module::Mask" => 0,
"Moo" => "1.003",
diff --git a/debian/changelog b/debian/changelog
index 9898fd5..3421eb0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libchi-perl (0.241+git20220107.1.4e59ee1-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 14 Oct 2022 15:14:00 -0000
+
libchi-perl (0.61-1) unstable; urgency=medium
[ Damyan Ivanov ]
diff --git a/debian/patches/0001-Adapt-to-changes-in-Cache-FastMmap-1.45.patch b/debian/patches/0001-Adapt-to-changes-in-Cache-FastMmap-1.45.patch
index f1a382f..2542bc9 100644
--- a/debian/patches/0001-Adapt-to-changes-in-Cache-FastMmap-1.45.patch
+++ b/debian/patches/0001-Adapt-to-changes-in-Cache-FastMmap-1.45.patch
@@ -24,9 +24,11 @@ Bug-Debian: https://bugs.debian.org/870235
lib/CHI/t/Driver/FastMmap.pm | 6 +++++-
2 files changed, 12 insertions(+), 4 deletions(-)
---- a/lib/CHI/Driver/FastMmap.pm
-+++ b/lib/CHI/Driver/FastMmap.pm
-@@ -21,7 +21,11 @@
+Index: libchi-perl.git/lib/CHI/Driver/FastMmap.pm
+===================================================================
+--- libchi-perl.git.orig/lib/CHI/Driver/FastMmap.pm
++++ libchi-perl.git/lib/CHI/Driver/FastMmap.pm
+@@ -21,7 +21,11 @@ sub BUILD {
mkpath( $self->root_dir, 0, $self->dir_create_mode )
if !-d $self->root_dir;
$self->{fm_params} = {
@@ -39,7 +41,7 @@ Bug-Debian: https://bugs.debian.org/870235
unlink_on_exit => 0,
share_file => catfile(
$self->root_dir,
-@@ -107,8 +111,8 @@
+@@ -107,8 +111,8 @@ though not between hosts.
To support namespaces, this driver takes a directory parameter rather than a
file, and creates one Cache::FastMMap file for each namespace.
@@ -50,9 +52,11 @@ Bug-Debian: https://bugs.debian.org/870235
all cache files are permanent.
=head1 REQUIREMENTS
---- a/lib/CHI/t/Driver/FastMmap.pm
-+++ b/lib/CHI/t/Driver/FastMmap.pm
-@@ -35,7 +35,11 @@
+Index: libchi-perl.git/lib/CHI/t/Driver/FastMmap.pm
+===================================================================
+--- libchi-perl.git.orig/lib/CHI/t/Driver/FastMmap.pm
++++ libchi-perl.git/lib/CHI/t/Driver/FastMmap.pm
+@@ -35,7 +35,11 @@ sub test_fm_cache : Tests {
my %defaults = (
unlink_on_exit => 0,
empty_on_exit => 0,
diff --git a/etc/bench/bench.pl b/etc/bench/bench.pl
old mode 100644
new mode 100755
index fd36649..0638b18
--- a/etc/bench/bench.pl
+++ b/etc/bench/bench.pl
@@ -1,376 +1,375 @@
-#!/usr/bin/perl
-#
-# Compare various cache backends
-#
-use Benchmark qw(:hireswallclock timethese);
-use Capture::Tiny qw(capture);
-use Cwd qw(realpath);
-use Data::Dump qw(dump);
-use DBI;
-use DBD::mysql;
-use File::Basename;
-use File::Path;
-use Getopt::Long;
-use Hash::MoreUtils qw(slice_def);
-use List::Util qw(sum);
-use List::MoreUtils qw(uniq);
-use Pod::Usage;
-use Text::Table;
-use Try::Tiny;
-use YAML::Any qw(DumpFile);
-use Module::Runtime qw(require_module);
-use warnings;
-use strict;
-
-my %cache_generators = cache_generators();
-
-sub usage {
- pod2usage( -verbose => 1, -exitval => "NOEXIT" );
- print "Valid drivers: " . join( ", ", sort keys(%cache_generators) ) . "\n";
- print "To install all requirements:\n cpanm "
- . join( " ",
- sort( uniq( map { @{ $_->{req} || [] } } values(%cache_generators) ) ) )
- . "\n";
- exit(1);
-}
-
-my $time = 2;
-my ( $complex, $drivers_pattern, $help, $incs, $sort_by_name );
-usage() if !@ARGV;
-GetOptions(
- 'd|drivers=s' => \$drivers_pattern,
- 'h|help' => \$help,
- 'n' => \$sort_by_name,
- 't|time=s' => \$time,
- 'x|complex' => \$complex,
-) or usage();
-usage() if $help || !$drivers_pattern;
-
-my $value =
- $complex
- ? { map { ( $_, scalar( $_ x 100 ) ) } qw(a b c d e) }
- : scalar( 'x' x 500 );
-my $num_keys = 1000;
-
-require CHI;
-
-print "CHI version $CHI::VERSION\n" if $CHI::VERSION;
-
-my $cwd = dirname( realpath($0) );
-my $data = "$cwd/data";
-rmtree($data);
-mkpath( $data, 0, 0775 );
-
-my %common_chi_opts = ( on_get_error => 'die', on_set_error => 'die' );
-
-my %caches;
-foreach my $name ( grep { /$drivers_pattern/ } keys(%cache_generators) ) {
- try {
- if ( my $req = $cache_generators{$name}->{req} ) {
- require_module($_) foreach @$req;
- }
- $caches{$name} = $cache_generators{$name}->{code}->();
- }
- catch {
- warn "error initializing '$name', will skip - $_";
- };
-}
-
-my @names = sort( keys(%caches) );
-print "Drivers: " . join( ", ", @names ) . "\n";
-
-my %counts;
-
-# Sets
-my $set_results;
-print "Benchmarking sets\n";
-$set_results = timethese(
- -1 * $time,
- {
- map {
- my $name = $_;
- my $cache = $caches{$name};
- my $key = 0;
- (
- $name,
- sub {
- my $key = ( $counts{$name}++ % 100 );
- $cache->set( $key, $value );
- }
- );
- } @names
- }
-);
-
-# Gets
-my $get_results;
-print "Benchmarking gets\n";
-$get_results = timethese(
- -1 * $time,
- {
- map {
- my $name = $_;
- my $cache = $caches{$name};
- my $key = 0;
- (
- $name,
- sub {
- my $key = ( $counts{$name}++ % 100 );
- $cache->get($key);
- }
- );
- } @names
- }
-);
-
-my %colvalues;
-foreach my $name (@names) {
- my $generator = $cache_generators{$name};
- my $get = ms_time( $get_results->{$name} );
- my $set = ms_time( $set_results->{$name} );
- my @colvalues = ( $name, $get . "ms", $set . "ms", $generator->{desc}, );
- $colvalues{$name} = \@colvalues;
-}
-
-my $tb = Text::Table->new(
- 'Cache',
- "Get time\n&right",
- "Set time\n&right",
- 'Description'
-);
-my $sort_field = $sort_by_name ? 0 : 1;
-my @rows =
- sort { $colvalues{$a}->[$sort_field] cmp $colvalues{$b}->[$sort_field] }
- keys(%colvalues);
-$tb->add( @{ $colvalues{$_} } ) for @rows;
-
-print $tb;
-
-sub ms_time {
- my $result = shift;
- return sprintf( "%0.3f", ( $result->[0] / $result->[5] ) * 1000 );
-}
-
-sub cache_generators {
- return (
- cache_cache_file => {
- req => ['Cache::FileCache'],
- desc => 'Cache::FileCache',
- code => sub {
- Cache::FileCache->new(
- {
- cache_root => "$data/cachecache/file",
- cache_depth => 2,
- }
- );
- }
- },
- cache_cache_memory => {
- req => ['Cache::MemoryCache'],
- desc => 'Cache::MemoryCache',
- code => sub {
- Cache::MemoryCache->new();
- }
- },
- cache_fastmmap => {
- req => ['Cache::FastMmap'],
- desc => 'Cache::FastMmap',
- code => sub {
-
- my $fastmmap_file = "$data/fastmmap.fm";
- Cache::FastMmap->new( share_file => $fastmmap_file, );
- }
- },
- cache_memcached_lib => {
- req => ['Cache::Memcached::libmemcached'],
- desc => 'Cache::Memcached::libmemcached',
- code => sub {
- Cache::Memcached::libmemcached->new(
- { servers => ["localhost:11211"] },
- );
- }
- },
- cache_memcached_fast => {
- req => ['Cache::Memcached::Fast'],
- desc => 'Cache::Memcached::Fast',
- code => sub {
- Cache::Memcached::Fast->new(
- { servers => ["localhost:11211"] } );
- }
- },
- cache_memcached_std => {
- req => ['Cache::Memcached'],
- desc => 'Cache::Memcached',
- code => sub {
- Cache::Memcached->new( { servers => ["localhost:11211"] } );
- }
- },
- cache_ref => {
- req => ['Cache::Ref::CART'],
- desc => 'Cache::Ref (CART)',
- code => sub {
- Cache::Ref::CART->new( size => 10000 );
- }
- },
- chi_berkeleydb => {
- req => ['CHI::Driver::BerkeleyDB'],
- desc => 'CHI::Driver::BerkeleyDB',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'BerkeleyDB',
- root_dir => "$data/chi/berkeleydb",
- );
- }
- },
- chi_dbi_mysql => {
- req => [ 'CHI::Driver::DBI', 'DBD::mysql' ],
- desc => 'CHI::Driver::DBI (mysql)',
- code => sub {
- my $mysql_dbh =
- DBI->connect( "DBI:mysql:database=chibench;host=localhost",
- "chibench", "chibench" );
- CHI->new(
- %common_chi_opts,
- driver => 'DBI',
- dbh => $mysql_dbh,
- create_table => 1,
- );
- }
- },
- chi_dbi_sqlite => {
- req => [ 'CHI::Driver::DBI', 'DBD::SQLite' ],
- desc => 'CHI::Driver::DBI (sqlite)',
- code => sub {
- my $sqlite_dbh =
- DBI->connect( "DBI:SQLite:dbname=$data/sqlite.db",
- "chibench", "chibench" );
- CHI->new(
- %common_chi_opts,
- driver => 'DBI',
- dbh => $sqlite_dbh,
- create_table => 1,
- );
- }
- },
- chi_fastmmap => {
- desc => 'CHI::Driver::FastMmap',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'FastMmap',
- root_dir => "$data/chi/fastmmap",
- );
- }
- },
- chi_file => {
- desc => 'CHI::Driver::File',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'File',
- root_dir => "$data/chi/file",
- depth => 2
- );
- }
- },
- chi_memcached_fast => {
- req => ['CHI::Driver::Memcached::Fast'],
- desc => 'CHI::Driver::Memcached::Fast',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'Memcached::Fast',
- servers => ["localhost:11211"],
- );
- }
- },
- chi_memcached_lib => {
- req => ['CHI::Driver::Memcached::libmemcached'],
- desc => 'CHI::Driver::Memcached::libmemcached',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'Memcached::libmemcached',
- servers => ["localhost:11211"],
- );
- }
- },
- chi_memcached_std => {
- req => ['CHI::Driver::Memcached'],
- desc => 'CHI::Driver::Memcached',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'Memcached',
- servers => ["localhost:11211"],
- );
- }
- },
- chi_memory => {
- desc => 'CHI::Driver::Memory',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'Memory',
- datastore => {},
- );
- }
- },
- chi_memory_raw => {
- desc => 'CHI::Driver::RawMemory',
- code => sub {
- CHI->new(
- %common_chi_opts,
- driver => 'RawMemory',
- datastore => {},
- );
- },
- },
- );
-}
-
-__END__
-
-=head1 NAME
-
-bench.pl -- Benchmark cache modules against each other
-
-=head1 DESCRIPTION
-
-Uses L<Benchmark> to compare a variety of CHI and non-CHI caches in terms of
-raw reading and writing speed. Sorts results by read performance. Does not
-attempt to test discard policies.
-
-=head1 SYNOPSIS
-
-bench.pl -d driver_regex [options]
-
-=head1 OPTIONS
-
- -d driver_regex Run drivers matching this regex (required) - use '.' for all
- -h --help Print help message
- -n Sort results by name instead of by read performance
- -t time Number of seconds to benchmark each operation (default 2)
- -x|--complex Use a complex data structure instead of a scalar
-
-Run bench.pl with no arguemnts to get a full list of available drivers.
-
-=head1 REQUIREMENTS
-
-=over
-
-=item *
-
-For the mysql drivers, run this as mysql root:
-
- create database chibench;
- grant all privileges on chibench.* to 'chibench'@'localhost' identified by 'chibench';
-
-=item *
-
-For the memcached drivers, you'll need to start memcached on the default port (11211).
-
-=back
-
-=cut
+#!/usr/bin/perl
+#
+# Compare various cache backends
+#
+use Benchmark qw(:hireswallclock timethese);
+use Capture::Tiny qw(capture);
+use Cwd qw(realpath);
+use Data::Dump qw(dump);
+use DBI;
+use DBD::mysql;
+use File::Basename;
+use File::Path;
+use Getopt::Long;
+use Hash::MoreUtils qw(slice_def);
+use List::Util qw(uniq);
+use Pod::Usage;
+use Text::Table;
+use Try::Tiny;
+use YAML::Any qw(DumpFile);
+use Module::Runtime qw(require_module);
+use warnings;
+use strict;
+
+my %cache_generators = cache_generators();
+
+sub usage {
+ pod2usage( -verbose => 1, -exitval => "NOEXIT" );
+ print "Valid drivers: " . join( ", ", sort keys(%cache_generators) ) . "\n";
+ print "To install all requirements:\n cpanm "
+ . join( " ",
+ sort( uniq( map { @{ $_->{req} || [] } } values(%cache_generators) ) ) )
+ . "\n";
+ exit(1);
+}
+
+my $time = 2;
+my ( $complex, $drivers_pattern, $help, $incs, $sort_by_name );
+usage() if !@ARGV;
+GetOptions(
+ 'd|drivers=s' => \$drivers_pattern,
+ 'h|help' => \$help,
+ 'n' => \$sort_by_name,
+ 't|time=s' => \$time,
+ 'x|complex' => \$complex,
+) or usage();
+usage() if $help || !$drivers_pattern;
+
+my $value =
+ $complex
+ ? { map { ( $_, scalar( $_ x 100 ) ) } qw(a b c d e) }
+ : scalar( 'x' x 500 );
+my $num_keys = 1000;
+
+require CHI;
+
+print "CHI version $CHI::VERSION\n" if $CHI::VERSION;
+
+my $cwd = dirname( realpath($0) );
+my $data = "$cwd/data";
+rmtree($data);
+mkpath( $data, 0, 0775 );
+
+my %common_chi_opts = ( on_get_error => 'die', on_set_error => 'die' );
+
+my %caches;
+foreach my $name ( grep { /$drivers_pattern/ } keys(%cache_generators) ) {
+ try {
+ if ( my $req = $cache_generators{$name}->{req} ) {
+ require_module($_) foreach @$req;
+ }
+ $caches{$name} = $cache_generators{$name}->{code}->();
+ }
+ catch {
+ warn "error initializing '$name', will skip - $_";
+ };
+}
+
+my @names = sort( keys(%caches) );
+print "Drivers: " . join( ", ", @names ) . "\n";
+
+my %counts;
+
+# Sets
+my $set_results;
+print "Benchmarking sets\n";
+$set_results = timethese(
+ -1 * $time,
+ {
+ map {
+ my $name = $_;
+ my $cache = $caches{$name};
+ my $key = 0;
+ (
+ $name,
+ sub {
+ my $key = ( $counts{$name}++ % 100 );
+ $cache->set( $key, $value );
+ }
+ );
+ } @names
+ }
+);
+
+# Gets
+my $get_results;
+print "Benchmarking gets\n";
+$get_results = timethese(
+ -1 * $time,
+ {
+ map {
+ my $name = $_;
+ my $cache = $caches{$name};
+ my $key = 0;
+ (
+ $name,
+ sub {
+ my $key = ( $counts{$name}++ % 100 );
+ $cache->get($key);
+ }
+ );
+ } @names
+ }
+);
+
+my %colvalues;
+foreach my $name (@names) {
+ my $generator = $cache_generators{$name};
+ my $get = ms_time( $get_results->{$name} );
+ my $set = ms_time( $set_results->{$name} );
+ my @colvalues = ( $name, $get . "ms", $set . "ms", $generator->{desc}, );
+ $colvalues{$name} = \@colvalues;
+}
+
+my $tb = Text::Table->new(
+ 'Cache',
+ "Get time\n&right",
+ "Set time\n&right",
+ 'Description'
+);
+my $sort_field = $sort_by_name ? 0 : 1;
+my @rows =
+ sort { $colvalues{$a}->[$sort_field] cmp $colvalues{$b}->[$sort_field] }
+ keys(%colvalues);
+$tb->add( @{ $colvalues{$_} } ) for @rows;
+
+print $tb;
+
+sub ms_time {
+ my $result = shift;
+ return sprintf( "%0.3f", ( $result->[0] / $result->[5] ) * 1000 );
+}
+
+sub cache_generators {
+ return (
+ cache_cache_file => {
+ req => ['Cache::FileCache'],
+ desc => 'Cache::FileCache',
+ code => sub {
+ Cache::FileCache->new(
+ {
+ cache_root => "$data/cachecache/file",
+ cache_depth => 2,
+ }
+ );
+ }
+ },
+ cache_cache_memory => {
+ req => ['Cache::MemoryCache'],
+ desc => 'Cache::MemoryCache',
+ code => sub {
+ Cache::MemoryCache->new();
+ }
+ },
+ cache_fastmmap => {
+ req => ['Cache::FastMmap'],
+ desc => 'Cache::FastMmap',
+ code => sub {
+
+ my $fastmmap_file = "$data/fastmmap.fm";
+ Cache::FastMmap->new( share_file => $fastmmap_file, );
+ }
+ },
+ cache_memcached_lib => {
+ req => ['Cache::Memcached::libmemcached'],
+ desc => 'Cache::Memcached::libmemcached',
+ code => sub {
+ Cache::Memcached::libmemcached->new(
+ { servers => ["localhost:11211"] },
+ );
+ }
+ },
+ cache_memcached_fast => {
+ req => ['Cache::Memcached::Fast'],
+ desc => 'Cache::Memcached::Fast',
+ code => sub {
+ Cache::Memcached::Fast->new(
+ { servers => ["localhost:11211"] } );
+ }
+ },
+ cache_memcached_std => {
+ req => ['Cache::Memcached'],
+ desc => 'Cache::Memcached',
+ code => sub {
+ Cache::Memcached->new( { servers => ["localhost:11211"] } );
+ }
+ },
+ cache_ref => {
+ req => ['Cache::Ref::CART'],
+ desc => 'Cache::Ref (CART)',
+ code => sub {
+ Cache::Ref::CART->new( size => 10000 );
+ }
+ },
+ chi_berkeleydb => {
+ req => ['CHI::Driver::BerkeleyDB'],
+ desc => 'CHI::Driver::BerkeleyDB',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'BerkeleyDB',
+ root_dir => "$data/chi/berkeleydb",
+ );
+ }
+ },
+ chi_dbi_mysql => {
+ req => [ 'CHI::Driver::DBI', 'DBD::mysql' ],
+ desc => 'CHI::Driver::DBI (mysql)',
+ code => sub {
+ my $mysql_dbh =
+ DBI->connect( "DBI:mysql:database=chibench;host=localhost",
+ "chibench", "chibench" );
+ CHI->new(
+ %common_chi_opts,
+ driver => 'DBI',
+ dbh => $mysql_dbh,
+ create_table => 1,
+ );
+ }
+ },
+ chi_dbi_sqlite => {
+ req => [ 'CHI::Driver::DBI', 'DBD::SQLite' ],
+ desc => 'CHI::Driver::DBI (sqlite)',
+ code => sub {
+ my $sqlite_dbh =
+ DBI->connect( "DBI:SQLite:dbname=$data/sqlite.db",
+ "chibench", "chibench" );
+ CHI->new(
+ %common_chi_opts,
+ driver => 'DBI',
+ dbh => $sqlite_dbh,
+ create_table => 1,
+ );
+ }
+ },
+ chi_fastmmap => {
+ desc => 'CHI::Driver::FastMmap',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'FastMmap',
+ root_dir => "$data/chi/fastmmap",
+ );
+ }
+ },
+ chi_file => {
+ desc => 'CHI::Driver::File',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'File',
+ root_dir => "$data/chi/file",
+ depth => 2
+ );
+ }
+ },
+ chi_memcached_fast => {
+ req => ['CHI::Driver::Memcached::Fast'],
+ desc => 'CHI::Driver::Memcached::Fast',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'Memcached::Fast',
+ servers => ["localhost:11211"],
+ );
+ }
+ },
+ chi_memcached_lib => {
+ req => ['CHI::Driver::Memcached::libmemcached'],
+ desc => 'CHI::Driver::Memcached::libmemcached',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'Memcached::libmemcached',
+ servers => ["localhost:11211"],
+ );
+ }
+ },
+ chi_memcached_std => {
+ req => ['CHI::Driver::Memcached'],
+ desc => 'CHI::Driver::Memcached',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'Memcached',
+ servers => ["localhost:11211"],
+ );
+ }
+ },
+ chi_memory => {
+ desc => 'CHI::Driver::Memory',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'Memory',
+ datastore => {},
+ );
+ }
+ },
+ chi_memory_raw => {
+ desc => 'CHI::Driver::RawMemory',
+ code => sub {
+ CHI->new(
+ %common_chi_opts,
+ driver => 'RawMemory',
+ datastore => {},
+ );
+ },
+ },
+ );
+}
+
+__END__
+
+=head1 NAME
+
+bench.pl -- Benchmark cache modules against each other
+
+=head1 DESCRIPTION
+
+Uses L<Benchmark> to compare a variety of CHI and non-CHI caches in terms of
+raw reading and writing speed. Sorts results by read performance. Does not
+attempt to test discard policies.
+
+=head1 SYNOPSIS
+
+bench.pl -d driver_regex [options]
+
+=head1 OPTIONS
+
+ -d driver_regex Run drivers matching this regex (required) - use '.' for all
+ -h --help Print help message
+ -n Sort results by name instead of by read performance
+ -t time Number of seconds to benchmark each operation (default 2)
+ -x|--complex Use a complex data structure instead of a scalar
+
+Run bench.pl with no arguemnts to get a full list of available drivers.
+
+=head1 REQUIREMENTS
+
+=over
+
+=item *
+
+For the mysql drivers, run this as mysql root:
+
+ create database chibench;
+ grant all privileges on chibench.* to 'chibench'@'localhost' identified by 'chibench';
+
+=item *
+
+For the memcached drivers, you'll need to start memcached on the default port (11211).
+
+=back
+
+=cut
diff --git a/lib/CHI/Driver/Base/CacheContainer.pm b/lib/CHI/Driver/Base/CacheContainer.pm
index fdbfb7d..c0163d3 100644
--- a/lib/CHI/Driver/Base/CacheContainer.pm
+++ b/lib/CHI/Driver/Base/CacheContainer.pm
@@ -1,7 +1,6 @@
package CHI::Driver::Base::CacheContainer;
$CHI::Driver::Base::CacheContainer::VERSION = '0.61';
use Moo;
-use List::MoreUtils qw( all );
use strict;
use warnings;
diff --git a/lib/CHI/Test.pm b/lib/CHI/Test.pm
index 1dfaacc..2fc05a9 100644
--- a/lib/CHI/Test.pm
+++ b/lib/CHI/Test.pm
@@ -3,7 +3,6 @@
package CHI::Test;
$CHI::Test::VERSION = '0.61';
use Log::Any::Test; # as early as possible
-use List::MoreUtils qw(uniq);
use Module::Runtime qw(require_module);
use CHI;
use CHI::Driver::Memory;
diff --git a/lib/CHI/t/Util.pm b/lib/CHI/t/Util.pm
index d683a6a..ac32f90 100644
--- a/lib/CHI/t/Util.pm
+++ b/lib/CHI/t/Util.pm
@@ -5,7 +5,7 @@ use warnings;
use CHI::Test;
use CHI::Util qw(unique_id parse_memory_size);
use CHI::Test::Util qw(random_string);
-use List::MoreUtils qw(uniq);
+use List::Util qw(uniq);
use base qw(CHI::Test::Class);
# The inevitably lame unique_id test
diff --git a/t/00-load.t b/t/00-load.t
index 9067ff6..30da15d 100644
--- a/t/00-load.t
+++ b/t/00-load.t
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-
-use Test::More tests => 1;
-
-BEGIN {
- use_ok('CHI');
-}
-
-diag("Testing CHI $CHI::VERSION, Perl $], $^X");
+#!/usr/bin/perl
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok('CHI');
+}
+
+diag("Testing CHI $CHI::VERSION, Perl $], $^X");
diff --git a/t/Bugs.t b/t/Bugs.t
index 97369ce..0892ee1 100644
--- a/t/Bugs.t
+++ b/t/Bugs.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Bugs;
-CHI::t::Bugs->runtests;
+#!/usr/bin/perl
+use CHI::t::Bugs;
+CHI::t::Bugs->runtests;
diff --git a/t/Config.t b/t/Config.t
index 6116205..f986355 100644
--- a/t/Config.t
+++ b/t/Config.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Config;
-CHI::t::Config->runtests;
+#!/usr/bin/perl
+use CHI::t::Config;
+CHI::t::Config->runtests;
diff --git a/t/Constants.t b/t/Constants.t
index e5899b0..bf26aa9 100644
--- a/t/Constants.t
+++ b/t/Constants.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Constants;
-CHI::t::Constants->runtests;
+#!/usr/bin/perl
+use CHI::t::Constants;
+CHI::t::Constants->runtests;
diff --git a/t/Driver-Memory.t b/t/Driver-Memory.t
index 2c1fc4a..8da6455 100644
--- a/t/Driver-Memory.t
+++ b/t/Driver-Memory.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Driver::Memory;
-CHI::t::Driver::Memory->runtests;
+#!/usr/bin/perl
+use CHI::t::Driver::Memory;
+CHI::t::Driver::Memory->runtests;
diff --git a/t/Driver-RawMemory.t b/t/Driver-RawMemory.t
index 51cba7d..8118f60 100644
--- a/t/Driver-RawMemory.t
+++ b/t/Driver-RawMemory.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Driver::RawMemory;
-CHI::t::Driver::RawMemory->runtests;
+#!/usr/bin/perl
+use CHI::t::Driver::RawMemory;
+CHI::t::Driver::RawMemory->runtests;
diff --git a/t/GetError.t b/t/GetError.t
index 2d45848..e1b6304 100644
--- a/t/GetError.t
+++ b/t/GetError.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::GetError;
-CHI::t::GetError->runtests;
+#!/usr/bin/perl
+use CHI::t::GetError;
+CHI::t::GetError->runtests;
diff --git a/t/Initialize.t b/t/Initialize.t
index 63f9371..d08ff2e 100644
--- a/t/Initialize.t
+++ b/t/Initialize.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Initialize;
-CHI::t::Initialize->runtests;
+#!/usr/bin/perl
+use CHI::t::Initialize;
+CHI::t::Initialize->runtests;
diff --git a/t/Sanity.t b/t/Sanity.t
index 54b67d8..483ee4e 100644
--- a/t/Sanity.t
+++ b/t/Sanity.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Sanity;
-CHI::t::Sanity->runtests;
+#!/usr/bin/perl
+use CHI::t::Sanity;
+CHI::t::Sanity->runtests;
diff --git a/t/SetError.t b/t/SetError.t
index ff4497a..040b1e3 100644
--- a/t/SetError.t
+++ b/t/SetError.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::SetError;
-CHI::t::SetError->runtests;
+#!/usr/bin/perl
+use CHI::t::SetError;
+CHI::t::SetError->runtests;
diff --git a/t/Subcache.t b/t/Subcache.t
index 24cd7b4..5d0266d 100644
--- a/t/Subcache.t
+++ b/t/Subcache.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Subcache;
-CHI::t::Subcache->runtests;
+#!/usr/bin/perl
+use CHI::t::Subcache;
+CHI::t::Subcache->runtests;
diff --git a/t/Subclass.t b/t/Subclass.t
index 0d88749..b774026 100644
--- a/t/Subclass.t
+++ b/t/Subclass.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Subclass;
-CHI::t::Subclass->runtests;
+#!/usr/bin/perl
+use CHI::t::Subclass;
+CHI::t::Subclass->runtests;
diff --git a/t/Util.t b/t/Util.t
index f5760f7..55ab559 100644
--- a/t/Util.t
+++ b/t/Util.t
@@ -1,3 +1,3 @@
-#!/usr/bin/perl
-use CHI::t::Util;
-CHI::t::Util->runtests;
+#!/usr/bin/perl
+use CHI::t::Util;
+CHI::t::Util->runtests;
diff --git a/t/author-03-pod.t b/t/author-03-pod.t
index 5d19799..97e7f1d 100644
--- a/t/author-03-pod.t
+++ b/t/author-03-pod.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
@@ -7,9 +7,9 @@ BEGIN {
}
}
-use strict;
-use warnings;
-use Test::More;
-use Test::Pod;
-
-all_pod_files_ok();
+use strict;
+use warnings;
+use Test::More;
+use Test::Pod;
+
+all_pod_files_ok();
diff --git a/t/author-RequiredModules.t b/t/author-RequiredModules.t
index 2ac050d..02d6211 100644
--- a/t/author-RequiredModules.t
+++ b/t/author-RequiredModules.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::RequiredModules;
-CHI::t::RequiredModules->runtests;
+use CHI::t::RequiredModules;
+CHI::t::RequiredModules->runtests;
diff --git a/t/author-file-driver.t b/t/author-file-driver.t
index f33137f..8415726 100644
--- a/t/author-file-driver.t
+++ b/t/author-file-driver.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
@@ -7,67 +7,67 @@ BEGIN {
}
}
-#
-use strict;
-use warnings;
-use File::Basename;
-use File::Temp qw(tempdir);
-use Test::More;
-use Test::Exception;
-use CHI;
-
-my $root_dir = tempdir( "file-digest-XXXX", TMPDIR => 1, CLEANUP => 1 );
-my $cache;
-my ( $keys, $values ) = set_standard_keys_and_values();
-my @keynames = sort keys(%$keys);
-
-plan tests => ( scalar(@keynames) * 2 + 1 );
-
-# Test key_digest (old name for key_digester) and file_extension
-#
-$cache = CHI->new(
- driver => 'File',
- root_dir => $root_dir,
- key_digest => 'SHA-1',
- file_extension => '.sha'
-);
-my $key = scalar( 'ab' x 256 );
-my $file = basename( $cache->path_to_key( $cache->transform_key($key) ) );
-is( $file, 'db62ffe116024a7a4e1bd949c0e30dbae9b5db77.sha', 'SHA-1 digest' );
-
-# Test that we can retrieve from a permanent cache in this directory. If
-# key escaping or metadata format changes between versions, this will break
-# - we at least want to know about it to warn users.
-#
-my $perm_cache = CHI->new( driver => 'File', root_dir => "t/permcache" );
-foreach my $keyname (@keynames) {
- is( $perm_cache->get( $keys->{$keyname} ),
- $values->{$keyname}, "get $keyname from perm test cache" );
- my $obj = $perm_cache->get_object( $keys->{$keyname} );
- is( $obj->created_at, 1275657865 );
-}
-
-sub set_standard_keys_and_values {
- my $self = shift;
-
- my ( %keys, %values );
- my @mixed_chars = ( 32 .. 48, 57 .. 65, 90 .. 97, 122 .. 126, 240 );
-
- %keys = (
- 'space' => ' ',
- 'newline' => "\n",
- 'char' => 'a',
- 'zero' => 0,
- 'one' => 1,
- 'medium' => 'medium',
- 'mixed' => join( "", map { chr($_) } @mixed_chars ),
- 'empty' => 'empty',
- );
-
- %values = map {
- ( $_, ref( $keys{$_} ) ? $keys{$_} : scalar( reverse( $keys{$_} ) ) )
- } keys(%keys);
- $values{empty} = '';
-
- return ( \%keys, \%values );
-}
+#
+use strict;
+use warnings;
+use File::Basename;
+use File::Temp qw(tempdir);
+use Test::More;
+use Test::Exception;
+use CHI;
+
+my $root_dir = tempdir( "file-digest-XXXX", TMPDIR => 1, CLEANUP => 1 );
+my $cache;
+my ( $keys, $values ) = set_standard_keys_and_values();
+my @keynames = sort keys(%$keys);
+
+plan tests => ( scalar(@keynames) * 2 + 1 );
+
+# Test key_digest (old name for key_digester) and file_extension
+#
+$cache = CHI->new(
+ driver => 'File',
+ root_dir => $root_dir,
+ key_digest => 'SHA-1',
+ file_extension => '.sha'
+);
+my $key = scalar( 'ab' x 256 );
+my $file = basename( $cache->path_to_key( $cache->transform_key($key) ) );
+is( $file, 'db62ffe116024a7a4e1bd949c0e30dbae9b5db77.sha', 'SHA-1 digest' );
+
+# Test that we can retrieve from a permanent cache in this directory. If
+# key escaping or metadata format changes between versions, this will break
+# - we at least want to know about it to warn users.
+#
+my $perm_cache = CHI->new( driver => 'File', root_dir => "t/permcache" );
+foreach my $keyname (@keynames) {
+ is( $perm_cache->get( $keys->{$keyname} ),
+ $values->{$keyname}, "get $keyname from perm test cache" );
+ my $obj = $perm_cache->get_object( $keys->{$keyname} );
+ is( $obj->created_at, 1275657865 );
+}
+
+sub set_standard_keys_and_values {
+ my $self = shift;
+
+ my ( %keys, %values );
+ my @mixed_chars = ( 32 .. 48, 57 .. 65, 90 .. 97, 122 .. 126, 240 );
+
+ %keys = (
+ 'space' => ' ',
+ 'newline' => "\n",
+ 'char' => 'a',
+ 'zero' => 0,
+ 'one' => 1,
+ 'medium' => 'medium',
+ 'mixed' => join( "", map { chr($_) } @mixed_chars ),
+ 'empty' => 'empty',
+ );
+
+ %values = map {
+ ( $_, ref( $keys{$_} ) ? $keys{$_} : scalar( reverse( $keys{$_} ) ) )
+ } keys(%keys);
+ $values{empty} = '';
+
+ return ( \%keys, \%values );
+}
diff --git a/t/author-no-data-serializer.t b/t/author-no-data-serializer.t
old mode 100644
new mode 100755
index ac78aa6..060fbb6
--- a/t/author-no-data-serializer.t
+++ b/t/author-no-data-serializer.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
@@ -7,38 +7,38 @@ BEGIN {
}
}
-#
-# Tests that things work ok (with warning) without Data::Serializer installed
-#
-use strict;
-use warnings;
-use Test::More tests => 3;
-use Test::Exception;
-use Module::Load::Conditional qw(can_load);
-BEGIN {
- package
- MaskNativeMessage;
- use base qw(Module::Mask);
- my $test_module = "NonExistantModule" . time;
- my $native_message = do { eval "require $test_module"; $@ };
- sub message {
- my ($class, $filename) = @_;
- (my $message = $native_message) =~ s/\Q$test_module.pm/$filename/;
- return $message;
- }
- $::mask = $::mask = MaskNativeMessage->new('Data::Serializer');
-}
-use CHI;
-
-require CHI::Driver;
-
-my $cache;
-throws_ok {
- $cache =
- CHI->new( driver => 'Memory', serializer => 'Data::Dumper', global => 1 );
-}
-qr/Could not load/, "dies with serializer";
-lives_ok { $cache = CHI->new( driver => 'Memory', global => 1 ) }
-"lives with no serializer";
-$cache->set( 'foo', 5 );
-is( $cache->get('foo'), 5, 'cache get ok' );
+#
+# Tests that things work ok (with warning) without Data::Serializer installed
+#
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Test::Exception;
+use Module::Load::Conditional qw(can_load);
+BEGIN {
+ package
+ MaskNativeMessage;
+ use base qw(Module::Mask);
+ my $test_module = "NonExistantModule" . time;
+ my $native_message = do { eval "require $test_module"; $@ };
+ sub message {
+ my ($class, $filename) = @_;
+ (my $message = $native_message) =~ s/\Q$test_module.pm/$filename/;
+ return $message;
+ }
+ $::mask = $::mask = MaskNativeMessage->new('Data::Serializer');
+}
+use CHI;
+
+require CHI::Driver;
+
+my $cache;
+throws_ok {
+ $cache =
+ CHI->new( driver => 'Memory', serializer => 'Data::Dumper', global => 1 );
+}
+qr/Could not load/, "dies with serializer";
+lives_ok { $cache = CHI->new( driver => 'Memory', global => 1 ) }
+"lives with no serializer";
+$cache->set( 'foo', 5 );
+is( $cache->get('foo'), 5, 'cache get ok' );
diff --git a/t/release-dependent.t b/t/release-dependent.t
index 1501231..254b991 100644
--- a/t/release-dependent.t
+++ b/t/release-dependent.t
@@ -6,63 +6,63 @@ BEGIN {
}
}
-use strict;
-use warnings;
-use Test::More;
-BEGIN {
- plan skip_all => <<'END_HELP' unless $ENV{CHI_TEST_MD};
-This test will not run unless you set CHI_TEST_MD to a true value.
-END_HELP
-}
-use Test::DependentModules qw(test_modules);
-
-#$ENV{CHI_REDIS_SERVER} = 1; # CHI::Driver::Redis
-#$ENV{FORCE_MEMCACHED_TESTS} = 1; # CHI::Cascade
-# extra dep: Cache::Memcached::libmemcached
-test_modules(qw(
- CGI::Application::Plugin::CHI
- CHI::Cascade
- CHI::Driver::BerkeleyDB
- CHI::Driver::DBI
- CHI::Driver::Memcached
- CHI::Driver::Redis
- CHI::Driver::SharedMem
- CHI::Memoize
- Cache::Profile
- Dancer::Plugin::Cache::CHI
- Dancer::Session::CHI
- Dezi::Bot
- Dist::Zilla::Role::MetaCPANInterfacer
- Elastic::Model
- File::DataClass
- Mason::Plugin::Cache
- Metabase
- Mojito
- Mojolicious::Plugin::CHI
- Parallel::ForkControl
- Perlanet
- RDF::Helper::Properties
- Rose::DBx::Object::Cached::CHI
- Search::OpenSearch
- Tapper::Reports::DPath
- Tie::CHI
- Yukki
-));
-
-#Mojolicious::Plugin::Cache # broken
-#Text::Corpus::CNN # broken
-#Text::Corpus::VoiceOfAmerica # broken
-#Geo::Heatmap # Image::Magick
-#CHI::Driver::Ping # no useful tests, also insane
-#CHI::Driver::MemcachedFast # tests broken
-#CHI::Driver::HandlerSocket # missing dep Net::HandlerSocket
-#App::ListPrereqs # no useful tests
-#Poet # broken dep
-#Plack::Middleware::ActiveMirror # no tests
-#Apache2::AutoTicketLDAP # apache
-#Net::FullAuto # wtf
-#CHI::Driver::TokyoTyrant # darkpan
-#Tapper::Testplan # tests broken
-#Template::Provider::Amazon::S3 # no useful tests
-
-done_testing;
+use strict;
+use warnings;
+use Test::More;
+BEGIN {
+ plan skip_all => <<'END_HELP' unless $ENV{CHI_TEST_MD};
+This test will not run unless you set CHI_TEST_MD to a true value.
+END_HELP
+}
+use Test::DependentModules qw(test_modules);
+
+#$ENV{CHI_REDIS_SERVER} = 1; # CHI::Driver::Redis
+#$ENV{FORCE_MEMCACHED_TESTS} = 1; # CHI::Cascade
+# extra dep: Cache::Memcached::libmemcached
+test_modules(qw(
+ CGI::Application::Plugin::CHI
+ CHI::Cascade
+ CHI::Driver::BerkeleyDB
+ CHI::Driver::DBI
+ CHI::Driver::Memcached
+ CHI::Driver::Redis
+ CHI::Driver::SharedMem
+ CHI::Memoize
+ Cache::Profile
+ Dancer::Plugin::Cache::CHI
+ Dancer::Session::CHI
+ Dezi::Bot
+ Dist::Zilla::Role::MetaCPANInterfacer
+ Elastic::Model
+ File::DataClass
+ Mason::Plugin::Cache
+ Metabase
+ Mojito
+ Mojolicious::Plugin::CHI
+ Parallel::ForkControl
+ Perlanet
+ RDF::Helper::Properties
+ Rose::DBx::Object::Cached::CHI
+ Search::OpenSearch
+ Tapper::Reports::DPath
+ Tie::CHI
+ Yukki
+));
+
+#Mojolicious::Plugin::Cache # broken
+#Text::Corpus::CNN # broken
+#Text::Corpus::VoiceOfAmerica # broken
+#Geo::Heatmap # Image::Magick
+#CHI::Driver::Ping # no useful tests, also insane
+#CHI::Driver::MemcachedFast # tests broken
+#CHI::Driver::HandlerSocket # missing dep Net::HandlerSocket
+#App::ListPrereqs # no useful tests
+#Poet # broken dep
+#Plack::Middleware::ActiveMirror # no tests
+#Apache2::AutoTicketLDAP # apache
+#Net::FullAuto # wtf
+#CHI::Driver::TokyoTyrant # darkpan
+#Tapper::Testplan # tests broken
+#Template::Provider::Amazon::S3 # no useful tests
+
+done_testing;
diff --git a/t/set_permcache.pl b/t/set_permcache.pl
old mode 100644
new mode 100755
index 77bdfcd..61e04ad
--- a/t/set_permcache.pl
+++ b/t/set_permcache.pl
@@ -1,44 +1,44 @@
-#!/usr/bin/perl
-#
-# Write permcache - for xt/author/file-driver.t and possibly other tests.
-#
-use CHI;
-use warnings;
-use strict;
-
-sub set_standard_keys_and_values {
- my $self = shift;
-
- my ( %keys, %values );
- my @mixed_chars = ( 32 .. 48, 57 .. 65, 90 .. 97, 122 .. 126, 240 );
-
- %keys = (
- 'space' => ' ',
- 'newline' => "\n",
- 'char' => 'a',
- 'zero' => 0,
- 'one' => 1,
- 'medium' => 'medium',
- 'mixed' => join( "", map { chr($_) } @mixed_chars ),
- 'large' => scalar( 'ab' x 256 ),
- 'empty' => 'empty',
- );
-
- %values = map {
- ( $_, ref( $keys{$_} ) ? $keys{$_} : scalar( reverse( $keys{$_} ) ) )
- } keys(%keys);
- $values{empty} = '';
-
- return ( \%keys, \%values );
-}
-
-my ( $keys, $values ) = set_standard_keys_and_values();
-my $perm_cache =
- CHI->new( driver => 'File', root_dir => "permcache", on_set_error => 'die' );
-$perm_cache->clear();
-foreach my $keyname ( sort keys(%$keys) ) {
- $perm_cache->set( $keys->{$keyname}, $values->{$keyname} );
-
- use d;
- dp [ $keys->{$keyname}, $perm_cache->path_to_key( $keys->{$keyname} ) ];
-}
+#!/usr/bin/perl
+#
+# Write permcache - for xt/author/file-driver.t and possibly other tests.
+#
+use CHI;
+use warnings;
+use strict;
+
+sub set_standard_keys_and_values {
+ my $self = shift;
+
+ my ( %keys, %values );
+ my @mixed_chars = ( 32 .. 48, 57 .. 65, 90 .. 97, 122 .. 126, 240 );
+
+ %keys = (
+ 'space' => ' ',
+ 'newline' => "\n",
+ 'char' => 'a',
+ 'zero' => 0,
+ 'one' => 1,
+ 'medium' => 'medium',
+ 'mixed' => join( "", map { chr($_) } @mixed_chars ),
+ 'large' => scalar( 'ab' x 256 ),
+ 'empty' => 'empty',
+ );
+
+ %values = map {
+ ( $_, ref( $keys{$_} ) ? $keys{$_} : scalar( reverse( $keys{$_} ) ) )
+ } keys(%keys);
+ $values{empty} = '';
+
+ return ( \%keys, \%values );
+}
+
+my ( $keys, $values ) = set_standard_keys_and_values();
+my $perm_cache =
+ CHI->new( driver => 'File', root_dir => "permcache", on_set_error => 'die' );
+$perm_cache->clear();
+foreach my $keyname ( sort keys(%$keys) ) {
+ $perm_cache->set( $keys->{$keyname}, $values->{$keyname} );
+
+ use d;
+ dp [ $keys->{$keyname}, $perm_cache->path_to_key( $keys->{$keyname} ) ];
+}
diff --git a/t/smoke-Driver-CacheCache.t b/t/smoke-Driver-CacheCache.t
index cd047e4..40def25 100644
--- a/t/smoke-Driver-CacheCache.t
+++ b/t/smoke-Driver-CacheCache.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::CacheCache;
-CHI::t::Driver::CacheCache->runtests;
+use CHI::t::Driver::CacheCache;
+CHI::t::Driver::CacheCache->runtests;
diff --git a/t/smoke-Driver-FastMmap.t b/t/smoke-Driver-FastMmap.t
index f737d69..83eda8a 100644
--- a/t/smoke-Driver-FastMmap.t
+++ b/t/smoke-Driver-FastMmap.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::FastMmap;
-CHI::t::Driver::FastMmap->runtests;
+use CHI::t::Driver::FastMmap;
+CHI::t::Driver::FastMmap->runtests;
diff --git a/t/smoke-Driver-File-DepthZero.t b/t/smoke-Driver-File-DepthZero.t
index 5090269..feba68e 100644
--- a/t/smoke-Driver-File-DepthZero.t
+++ b/t/smoke-Driver-File-DepthZero.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::File::DepthZero;
-CHI::t::Driver::File::DepthZero->runtests;
+use CHI::t::Driver::File::DepthZero;
+CHI::t::Driver::File::DepthZero->runtests;
diff --git a/t/smoke-Driver-File.t b/t/smoke-Driver-File.t
index a1f6a3d..95530b9 100644
--- a/t/smoke-Driver-File.t
+++ b/t/smoke-Driver-File.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::File;
-CHI::t::Driver::File->runtests;
+use CHI::t::Driver::File;
+CHI::t::Driver::File->runtests;
diff --git a/t/smoke-Driver-NonMoose.t b/t/smoke-Driver-NonMoose.t
index 5bf436a..92652e0 100644
--- a/t/smoke-Driver-NonMoose.t
+++ b/t/smoke-Driver-NonMoose.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::NonMoose;
-CHI::t::Driver::NonMoose->runtests;
+use CHI::t::Driver::NonMoose;
+CHI::t::Driver::NonMoose->runtests;
diff --git a/t/smoke-Driver-Subcache-l1_cache.t b/t/smoke-Driver-Subcache-l1_cache.t
index 811f2a4..c398ad0 100644
--- a/t/smoke-Driver-Subcache-l1_cache.t
+++ b/t/smoke-Driver-Subcache-l1_cache.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::Subcache::l1_cache;
-CHI::t::Driver::Subcache::l1_cache->runtests;
+use CHI::t::Driver::Subcache::l1_cache;
+CHI::t::Driver::Subcache::l1_cache->runtests;
diff --git a/t/smoke-Driver-Subcache-mirror_cache.t b/t/smoke-Driver-Subcache-mirror_cache.t
index 3262a38..3ce2d33 100644
--- a/t/smoke-Driver-Subcache-mirror_cache.t
+++ b/t/smoke-Driver-Subcache-mirror_cache.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Driver::Subcache::mirror_cache;
-CHI::t::Driver::Subcache::mirror_cache->runtests;
+use CHI::t::Driver::Subcache::mirror_cache;
+CHI::t::Driver::Subcache::mirror_cache->runtests;
diff --git a/t/smoke-Null.t b/t/smoke-Null.t
index a53c820..f4ac802 100644
--- a/t/smoke-Null.t
+++ b/t/smoke-Null.t
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -w
BEGIN {
unless ($ENV{AUTOMATED_TESTING}) {
@@ -7,5 +7,5 @@ BEGIN {
}
}
-use CHI::t::Null;
-CHI::t::Null->runtests;
+use CHI::t::Null;
+CHI::t::Null->runtests;
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files