line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
27
|
|
|
27
|
|
159
|
use warnings; |
|
27
|
|
|
|
|
44
|
|
|
27
|
|
|
|
|
680
|
|
4
|
27
|
|
|
27
|
|
113
|
|
|
27
|
|
|
|
|
44
|
|
|
27
|
|
|
|
|
629
|
|
5
|
|
|
|
|
|
|
use Digest::SHA qw(sha1_hex); |
6
|
27
|
|
|
27
|
|
11845
|
use Path::Tiny qw(path); |
|
27
|
|
|
|
|
62549
|
|
|
27
|
|
|
|
|
2087
|
|
7
|
27
|
|
|
27
|
|
5939
|
use Specio::Library::Path::Tiny; |
|
27
|
|
|
|
|
87479
|
|
|
27
|
|
|
|
|
1351
|
|
8
|
27
|
|
|
27
|
|
12194
|
|
|
27
|
|
|
|
|
2891210
|
|
|
27
|
|
|
|
|
342
|
|
9
|
|
|
|
|
|
|
use Moo; |
10
|
27
|
|
|
27
|
|
327156
|
|
|
27
|
|
|
|
|
245056
|
|
|
27
|
|
|
|
|
187
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.81'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has cache_dir => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => t('Path'), |
16
|
|
|
|
|
|
|
required => 1, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my ( $self, $key ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
114
|
|
|
114
|
0
|
2251
|
my $file = $self->_path_for_key($key); |
22
|
|
|
|
|
|
|
if ( $file->exists ) { |
23
|
114
|
|
|
|
|
395
|
return $file->slurp_raw; |
24
|
114
|
100
|
|
|
|
4632
|
} |
25
|
31
|
|
|
|
|
848
|
else { |
26
|
|
|
|
|
|
|
return undef; |
27
|
|
|
|
|
|
|
} |
28
|
83
|
|
|
|
|
2722
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my ( $self, $key, $value ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $file = $self->_path_for_key($key); |
33
|
78
|
|
|
78
|
0
|
1444
|
$file->parent->mkpath( { mode => 0755 } ); |
34
|
|
|
|
|
|
|
$file->spew_raw($value); |
35
|
78
|
|
|
|
|
284
|
|
36
|
78
|
|
|
|
|
3201
|
return; |
37
|
78
|
|
|
|
|
19017
|
} |
38
|
|
|
|
|
|
|
|
39
|
78
|
|
|
|
|
30902
|
my ( $self, $key, $value ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->_path_for_key($key)->remove; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
0
|
0
|
return; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
my ( $self, $key ) = @_; |
47
|
0
|
|
|
|
|
0
|
|
48
|
|
|
|
|
|
|
my $sig = sha1_hex($key); |
49
|
|
|
|
|
|
|
return $self->cache_dir->child( substr( $sig, 0, 1 ), "$sig.dat" ); |
50
|
|
|
|
|
|
|
} |
51
|
192
|
|
|
192
|
|
496
|
|
52
|
|
|
|
|
|
|
1; |
53
|
192
|
|
|
|
|
1283
|
|
54
|
192
|
|
|
|
|
1284
|
# ABSTRACT: A simple caching engine which stores key/value pairs |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Code::TidyAll::Cache - A simple caching engine which stores key/value pairs |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 0.81 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SUPPORT |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SOURCE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHORS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Jonathan Swartz <swartz@pobox.com> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2011 - 2022 by Jonathan Swartz. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The full text of the license can be found in the |
99
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |