File Coverage

blib/lib/CHI/Driver/Memcached.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package CHI::Driver::Memcached;
2             $CHI::Driver::Memcached::VERSION = '0.16';
3 1     1   38115 use Moose;
  0            
  0            
4             use strict;
5             use warnings;
6              
7             extends 'CHI::Driver::Memcached::Base';
8              
9             has '+memd_class' => ( default => 'Cache::Memcached' );
10              
11             __PACKAGE__->meta->make_immutable();
12              
13             1;
14              
15             __END__
16              
17             =pod
18              
19             =head1 NAME
20              
21             CHI::Driver::Memcached -- Distributed cache via memcached (memory cache daemon)
22              
23             =head1 VERSION
24              
25             version 0.16
26              
27             =head1 SYNOPSIS
28              
29             use CHI;
30              
31             my $cache = CHI->new(
32             driver => 'Memcached', # or 'Memcached::Fast', or 'Memcached::libmemcached'
33             namespace => 'products',
34             servers => [ "10.0.0.15:11211", "10.0.0.15:11212", "/var/sock/memcached",
35             "10.0.0.17:11211", [ "10.0.0.17:11211", 3 ] ],
36             debug => 0,
37             compress_threshold => 10_000,
38             );
39              
40             =head1 DESCRIPTION
41              
42             A CHI driver that uses Cache::Memcached to store data in the specified
43             memcached server(s).
44              
45             L<CHI::Driver::Memcached::Fast> and L<CHI::Driver::Memcached::libmemcached> are
46             also available as part of this distribution. They work with other Memcached
47             clients and support a similar feature set. Documentation for all three modules
48             is presented below.
49              
50             =head1 CONSTRUCTOR OPTIONS
51              
52             Namespace, appended with ":", is passed along to the Cached::Memcached::*
53             constructor, along with any constructor options L<not recognized by
54             CHI|CHI/constructor> - for example I<servers>, I<compress_threshold> and
55             I<debug>.
56              
57             If you need more control over the options passed to Cache::Memcached::*, you
58             may specify a hash directly in C<memd_params>.
59              
60             =head1 METHODS
61              
62             Besides the standard CHI methods:
63              
64             =over
65              
66             =item memd
67              
68             Returns a handle to the underlying Cache::Memcached::* object. You can use this
69             to call memcached-specific methods that are not supported by the general API,
70             e.g.
71              
72             $self->memd->incr("key");
73             my $stats = $self->memd->stats();
74              
75             =back
76              
77             =head1 UNSUPPORTED METHODS
78              
79             These standard CHI methods cannot currently be supported by memcached, chiefly
80             because there is no way to get a list of stored keys.
81              
82             =over
83              
84             =item dump_as_hash
85              
86             =item clear
87              
88             =item get_keys
89              
90             =item get_namespaces
91              
92             =item is_empty
93              
94             =item purge
95              
96             =back
97              
98             =head1 SUPPORT AND DOCUMENTATION
99              
100             Questions and feedback are welcome, and should be directed to the perl-cache
101             mailing list:
102              
103             http://groups.google.com/group/perl-cache-discuss
104              
105             Bugs and feature requests will be tracked at RT:
106              
107             http://rt.cpan.org/NoAuth/Bugs.html?Dist=CHI-Driver-Memcached
108              
109             The latest source code can be browsed and fetched at:
110              
111             http://github.com/jonswar/perl-chi-driver-memcached/tree/master
112             git clone git://github.com/jonswar/perl-chi-driver-memcached.git
113              
114             =head1 AUTHOR
115              
116             Jonathan Swartz
117              
118             =head1 SEE ALSO
119              
120             L<CHI|CHI>, L<Cache::Memcached|Cache::Memcached>,
121             L<CHI::Driver::Memcached::Fast>, L<CHI::Driver::Memcached::libmemcached>
122              
123             =head1 COPYRIGHT & LICENSE
124              
125             Copyright (C) 2007 Jonathan Swartz.
126              
127             CHI::Driver::Memcached is provided "as is" and without any express or implied
128             warranties, including, without limitation, the implied warranties of
129             merchantibility and fitness for a particular purpose.
130              
131             This program is free software; you can redistribute it and/or modify it under
132             the same terms as Perl itself.
133              
134             =head1 COPYRIGHT AND LICENSE
135              
136             This software is copyright (c) 2011 by Jonathan Swartz.
137              
138             This is free software; you can redistribute it and/or modify it under
139             the same terms as the Perl 5 programming language system itself.
140              
141             =cut