jonswar/perl-chi — pull request #12 by mcartmell (2012-04-25 11:09:37+00:00)
Title: bug in get_multi_arrayref with level1 cache

Hi Jonathan

I noticed that get_multi_arrayref always seemed to be returning undefs. It seems to be a bug when level1_cache is set, but it's only reproducible when the keys are not in the level1 cache, eg. if they have been set in another process, so it's not obvious.

The bug seemed to be that get_multi_arrayref was falling back to the main cache for keys that *are* found in the level1 cache, when it should only be looking for the remaining keys. Inverting the condition seems to fix it. I've attached a quick test case below.

Cheers

Mike

```perl
use strict;
use warnings;

use CHI;
use Test::More;
my %cache_args = (
driver => 'FastMmap',
root_dir => '/tmp/fmmap',
'l1_cache' => {
'global' => 1,
'driver' => 'Memory'
},

);
my $cache_2 = CHI->new(%cache_args);
delete $cache_args{l1_cache};

my $cache_1 = CHI->new(%cache_args);
$cache_1->set('mikec-one' => 'foo');
$cache_1->set('mikec-two' => 'bar');
my $values = $cache_2->get_multi_arrayref(['mikec-one', 'mikec-two']);
ok($values->[0] eq 'foo', 'get_multi works');
done_testing();
```