File Coverage

blib/lib/Cassandra/Client/Metadata.pm
Criterion Covered Total %
statement 8 23 34.7
branch 0 6 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 11 40 27.5


line stmt bran cond sub pod time code
1             package Cassandra::Client::Metadata;
2             our $AUTHORITY = 'cpan:TVDW';
3             $Cassandra::Client::Metadata::VERSION = '0.13_006'; # TRIAL
4              
5 1     1   14 $Cassandra::Client::Metadata::VERSION = '0.13006';use 5.010;
  1         4  
6 1     1   5 use strict;
  1         2  
  1         17  
7 1     1   4 use warnings;
  1         2  
  1         188  
8              
9             sub new {
10 0     0 0   my ($class, %args)= @_;
11              
12 0           return bless {
13             prepare_cache => {},
14             }, $class;
15             }
16              
17             sub prepare_cache {
18 0     0 0   return $_[0]{prepare_cache};
19             }
20              
21             sub add_prepared {
22 0     0 0   my ($self, $query, $id, $decoder, $encoder)= @_;
23 0           $self->{prepare_cache}{$query}= {
24             id => $id,
25             decoder => $decoder,
26             encoder => $encoder
27             };
28 0 0         if (values %{$self->{prepare_cache}} > 500) {
  0            
29 0 0         unless ($self->{warned}++) {
30 0           warn "Cassandra::Client: found more than 500 queries in our prepared statement cache, try using placeholders";
31             }
32             }
33 0           return;
34             }
35              
36             sub is_prepared {
37 0     0 0   my ($self, $queryref)= @_;
38 0           my $cached= $self->{prepare_cache}{$$queryref};
39 0 0         if (!$cached) { return; }
  0            
40              
41 0           return 1;
42             }
43              
44             1;
45              
46             __END__