|
|
017447f |
From 7fd8a51f2fcd362e390a94fb2fbef6ccef0e0a45 Mon Sep 17 00:00:00 2001
|
|
|
017447f |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
017447f |
Date: Wed, 3 May 2017 16:57:52 +0200
|
|
|
017447f |
Subject: [PATCH] Adapt to changes in Cache-FastMmap-1.45
|
|
|
017447f |
MIME-Version: 1.0
|
|
|
017447f |
Content-Type: text/plain; charset=UTF-8
|
|
|
017447f |
Content-Transfer-Encoding: 8bit
|
|
|
017447f |
|
|
|
017447f |
Cache-FastMmap-1.45 deprecated raw_values constructor argument in
|
|
|
017447f |
favor of new serializer argument. This changes caused
|
|
|
017447f |
t/smoke-Driver-CacheCache.t to fail.
|
|
|
017447f |
|
|
|
017447f |
This patch uses serializer with Cache::FastMmap >= 1.45, otherwise the old
|
|
|
017447f |
raw_values.
|
|
|
017447f |
|
|
|
017447f |
CPAN RT#120705
|
|
|
017447f |
|
|
|
017447f |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
017447f |
---
|
|
|
017447f |
lib/CHI/Driver/FastMmap.pm | 10 +++++++---
|
|
|
017447f |
lib/CHI/t/Driver/FastMmap.pm | 6 +++++-
|
|
|
017447f |
2 files changed, 12 insertions(+), 4 deletions(-)
|
|
|
017447f |
|
|
|
017447f |
diff --git a/lib/CHI/Driver/FastMmap.pm b/lib/CHI/Driver/FastMmap.pm
|
|
|
017447f |
index 521306c..4cadd13 100644
|
|
|
017447f |
--- a/lib/CHI/Driver/FastMmap.pm
|
|
|
017447f |
+++ b/lib/CHI/Driver/FastMmap.pm
|
|
|
017447f |
@@ -21,7 +21,11 @@ sub BUILD {
|
|
|
017447f |
mkpath( $self->root_dir, 0, $self->dir_create_mode )
|
|
|
017447f |
if !-d $self->root_dir;
|
|
|
017447f |
$self->{fm_params} = {
|
|
|
017447f |
- raw_values => 1,
|
|
|
017447f |
+ (
|
|
|
017447f |
+ ($Cache::FastMmap::VERSION >= 1.45) ?
|
|
|
017447f |
+ (serializer => '') :
|
|
|
017447f |
+ (raw_values => 1)
|
|
|
017447f |
+ ),
|
|
|
017447f |
unlink_on_exit => 0,
|
|
|
017447f |
share_file => catfile(
|
|
|
017447f |
$self->root_dir,
|
|
|
017447f |
@@ -107,8 +111,8 @@ though not between hosts.
|
|
|
017447f |
To support namespaces, this driver takes a directory parameter rather than a
|
|
|
017447f |
file, and creates one Cache::FastMMap file for each namespace.
|
|
|
017447f |
|
|
|
017447f |
-Because CHI handles serialization automatically, we pass the C<raw_values> flag
|
|
|
017447f |
-as 1; and to conform to the CHI API, we pass C<unlink_on_exit> as 0, so that
|
|
|
017447f |
+Because CHI handles serialization automatically, we pass the C<serializer> flag
|
|
|
017447f |
+as ''; and to conform to the CHI API, we pass C<unlink_on_exit> as 0, so that
|
|
|
017447f |
all cache files are permanent.
|
|
|
017447f |
|
|
|
017447f |
=head1 REQUIREMENTS
|
|
|
017447f |
diff --git a/lib/CHI/t/Driver/FastMmap.pm b/lib/CHI/t/Driver/FastMmap.pm
|
|
|
017447f |
index dd71ab2..2cc835d 100644
|
|
|
017447f |
--- a/lib/CHI/t/Driver/FastMmap.pm
|
|
|
017447f |
+++ b/lib/CHI/t/Driver/FastMmap.pm
|
|
|
017447f |
@@ -35,7 +35,11 @@ sub test_fm_cache : Tests {
|
|
|
017447f |
my %defaults = (
|
|
|
017447f |
unlink_on_exit => 0,
|
|
|
017447f |
empty_on_exit => 0,
|
|
|
017447f |
- raw_values => 1,
|
|
|
017447f |
+ (
|
|
|
017447f |
+ ($Cache::FastMmap::VERSION >= 1.45) ?
|
|
|
017447f |
+ (serialize => 0) :
|
|
|
017447f |
+ (raw_values => 1)
|
|
|
017447f |
+ ),
|
|
|
017447f |
);
|
|
|
017447f |
while ( my ( $key, $value ) = each(%defaults) ) {
|
|
|
017447f |
is( $fm_cache->{$key} || 0, $value, "$key = $value by default" );
|
|
|
017447f |
--
|
|
|
017447f |
2.7.4
|
|
|
017447f |
|