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.21';
4 13     13   316 use 5.010;
  13         67  
5 13     13   79 use strict;
  13         29  
  13         428  
6 13     13   63 use warnings;
  13         28  
  13         4345  
7              
8             sub new {
9 0     0 0   my ($class, %args)= @_;
10              
11 0           return bless {
12             prepare_cache => {},
13             }, $class;
14             }
15              
16             sub prepare_cache {
17 0     0 0   return $_[0]{prepare_cache};
18             }
19              
20             sub add_prepared {
21 0     0 0   my ($self, $query, $id, $decoder, $encoder)= @_;
22 0           $self->{prepare_cache}{$query}= {
23             id => $id,
24             decoder => $decoder,
25             encoder => $encoder
26             };
27 0 0         if (values %{$self->{prepare_cache}} > 500) {
  0            
28 0 0         unless ($self->{warned}++) {
29 0           warn "Cassandra::Client: found more than 500 queries in our prepared statement cache, try using placeholders";
30             }
31             }
32 0           return;
33             }
34              
35             sub is_prepared {
36 0     0 0   my ($self, $queryref)= @_;
37 0           my $cached= $self->{prepare_cache}{$$queryref};
38 0 0         if (!$cached) { return; }
  0            
39              
40 0           return 1;
41             }
42              
43             1;
44              
45             __END__