ShardedKV/Storage/Memory.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 4 totaltotal 86.6% 26 / 30 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
__ANON__
1.0
get
1.0
CRAP 1.0
« ShardedKV/Continuum/Ketama.pm ↑ Summary ShardedKV/Continuum.pm »
1 package ShardedKV::Storage::Memory;
2 3 $ShardedKV::Storage::Memory::VERSION = '0.20';
3 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 # ABSTRACT: Testing storage backend for in-memory storage
5  
6 3 with 'ShardedKV::Storage';
7  
8 has 'hash' => (
9 is => 'ro',
10 isa => 'HashRef',
11 16 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
12 3 );
13  
14 13215 ▶sub get {
Subroutine get: called CC=1 SCAR=0.0
Pod undocumented
15 13215 my ($self, $key) = @_;
16 13215 return $self->{hash}{$key};
17 }
18  
19 6506 ▶sub set {
Subroutine set: called CC=1 SCAR=0.0
Pod undocumented
20 6506 my ($self, $key, $value_ref) = @_;
21 6506 $self->{hash}{$key} = $value_ref;
22 6506 return 1;
23 }
24  
25 2008 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
Pod undocumented
26 2008 my ($self, $key) = @_;
27 2008 delete $self->{hash}{$key};
28 2008 return();
29 }
30  
31 # This is a noop for the Memory storage
32 263 ▶sub reset_connection { }
Subroutine reset_connection: called CC=1 SCAR=0.0
Pod undocumented
33  
34 3 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 3 __PACKAGE__->meta->make_immutable;
36  
37 =pod
38  
39 =head1 NAME
40  
41 ShardedKV::Storage::Memory - Testing storage backend for in-memory storage
42  
43 =head1 VERSION
44  
45 version 0.20
46  
47 =head1 SYNOPSIS
48  
49 TODO
50  
51 =head1 DESCRIPTION
52  
53 A C<ShardedKV> storage backend that uses a Perl in-memory hash for
54 storage. It is mainly intended for testing.
55  
56 Implements the C<ShardedKV::Storage> role.
57  
58 =head1 SEE ALSO
59  
60 =over 4
61  
62 =item *
63  
64 L<ShardedKV>
65  
66 =item *
67  
68 L<ShardedKV::Storage>
69  
70 =back
71  
72 =head1 AUTHORS
73  
74 =over 4
75  
76 =item *
77  
78 Steffen Mueller <smueller@cpan.org>
79  
80 =item *
81  
82 Nick Perez <nperez@cpan.org>
83  
84 =item *
85  
86 Damian Gryski <dgryski@cpan.org>
87  
88 =back
89  
90 =head1 COPYRIGHT AND LICENSE
91  
92 This software is copyright (c) 2013 by Steffen Mueller.
93  
94 This is free software; you can redistribute it and/or modify it under
95 the same terms as the Perl 5 programming language system itself.
96  
97 =cut
98  
99 __END__
« ShardedKV/Continuum/Ketama.pm ↑ Summary ShardedKV/Continuum.pm »