MtPolicyd/Connection/Memcached.pm

filter: Statementstmt 53.8% 14 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 2 totaltotal 45.7% 16 / 35 CC 1 SCAR 5.4
CC
1
Cov
54%
__ANON__
2.0
_create_handle
2.0
__ANON__
2.0
CRAP 1.7
« MtPolicyd/SessionCache/Base.pm ↑ Summary MtPolicyd/Result.pm »
1 package Mail::MtPolicyd::Connection::Memcached;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '2.01'; # VERSION
6 # ABSTRACT: a memcached connection plugin for mtpolicyd
7  
8 1 extends 'Mail::MtPolicyd::Connection';
9  
10  
11 1 ▶use Cache::Memcached;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 has 'servers' => ( is => 'ro', isa => 'Str', default => '127.0.0.1:11211' );
14 has '_servers' => (
15 is => 'ro', isa => 'ArrayRef[Str]', lazy => 1,
16 default => sub {
17 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
18 0 return [ split(/\s*,\s*/, $self->servers) ];
19 },
20 1 );
21  
22 1 has 'debug' => ( is => 'ro', isa => 'Bool', default => 0 );
23 1 has 'namespace' => ( is => 'ro', isa => 'Str', default => '');
24  
25 sub _create_handle {
26 0 ▶ my $self = shift;
Subroutine _create_handle: not called CC=1 SCAR=6.9
27 0 return Cache::Memcached->new( {
28 'servers' => $self->_servers,
29 'debug' => $self->debug,
30 'namespace' => $self->namespace,
31 } );
32 }
33  
34 has 'handle' => (
35 is => 'rw', isa => 'Cache::Memcached', lazy => 1,
36 default => sub {
37 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 0 $self->_create_handle
39 },
40 1 );
41  
42 sub reconnect {
43 0 ▶ my $self = shift;
Subroutine reconnect: not called CC=1 SCAR=6.9
Pod undocumented
44 0 $self->handle( $self->_create_handle );
45 0 return;
46 }
47  
48 sub shutdown {
49 0 ▶ my $self = shift;
Subroutine shutdown: not called CC=1 SCAR=6.9
Pod undocumented
50 0 $self->handle->disconnect_all;
51 0 return;
52 }
53  
54 1 1;
55  
56 __END__
57  
58 =pod
59  
60 =encoding UTF-8
61  
62 =head1 NAME
63  
64 Mail::MtPolicyd::Connection::Memcached - a memcached connection plugin for mtpolicyd
65  
66 =head1 VERSION
67  
68 version 2.01
69  
70 =head1 SYNOPSIS
71  
72 <Connection memcached>
73 module = "Memcached"
74 servers = "127.0.0.1:11211"
75 # namespace = "mt-"
76 </Connection>
77  
78 =head1 PARAMETERS
79  
80 =over
81  
82 =item servers (default: 127.0.0.1:11211)
83  
84 Comma seperated list for memcached servers to connect.
85  
86 =item debug (default: 0)
87  
88 Enable to debug memcached connection.
89  
90 =item namespace (default: '')
91  
92 Set a prefix used for all keys of this connection.
93  
94 =back
95  
96 =head1 AUTHOR
97  
98 Markus Benning <ich@markusbenning.de>
99  
100 =head1 COPYRIGHT AND LICENSE
101  
102 This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
103  
104 This is free software, licensed under:
105  
106 The GNU General Public License, Version 2, June 1991
107  
108 =cut
« MtPolicyd/SessionCache/Base.pm ↑ Summary MtPolicyd/Result.pm »