this repo has no description

Compare changes

Choose any two refs to compare.

Changed files
+27 -6
lib
CHI
Driver
MongoDB
t
CHIDriverTests
t
+4
.gitignore
···
+
MYMETA.yml
+
Makefile
+
blib/
+
pm_to_blib
+8
.travis.yml
···
+
language: perl
+
perl:
+
- "5.16"
+
- "5.14"
+
- "5.12"
+
- "5.10"
+
- "5.8"
+
services: mongodb
+11 -2
lib/CHI/Driver/MongoDB/t/CHIDriverTests/MongoDB.pm
···
};
}
+
sub new_cache_options {
+
my $self = shift;
+
+
return (
+
$self->SUPER::new_cache_options(),
+
db => $self->db,
+
);
+
}
+
sub test_with_database : Tests(1) {
return "MongoDB::Database not installed"
unless can_load( modules => { "MongoDB::Database" => undef } );
-
my $self = shift;
+
my $self = shift;
my $cache = CHI->new(
driver => "MongoDB",
db => $self->db
···
return "MongoDB::Connection not installed"
unless can_load( modules => { "MongoDB::Connection" => undef } );
-
my $self = shift;
+
my $self = shift;
my $cache = CHI->new(
driver => "MongoDB",
conn => MongoDB::Connection->new,
+3 -3
lib/CHI/Driver/MongoDB.pm
···
sub fetch {
my ( $self, $key ) = @_;
-
my $results = $self->collection->find_one( { _id => $key }, { data => 1 } );
+
my $results = $self->collection->find_one( { _id => "$key" }, { data => 1 } );
return ($results) ? $results->{data} : undef;
}
sub store {
my ( $self, $key, $data ) = @_;
-
$self->collection->save( { _id => $key, data => $data },
+
$self->collection->save( { _id => "$key", data => $data },
{ safe => $self->{safe} } );
return;
}
···
sub remove {
my ( $self, $key ) = @_;
-
$self->collection->remove( { _id => $key }, { safe => $self->{safe} } );
+
$self->collection->remove( { _id => "$key" }, { safe => $self->{safe} } );
return;
}
+1 -1
t/CHIDriverTests-MongoDB.t
···
#!perl -w
use strict;
use warnings;
-
use CHI::Driver::MongoDB::t:CHIDriverTests::MongoDB;
+
use CHI::Driver::MongoDB::t::CHIDriverTests::MongoDB;
CHI::Driver::MongoDB::t::CHIDriverTests::MongoDB->runtests;