| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
|
3
|
27
|
|
|
27
|
|
165
|
use warnings; |
|
|
27
|
|
|
|
|
47
|
|
|
|
27
|
|
|
|
|
642
|
|
|
4
|
27
|
|
|
27
|
|
109
|
|
|
|
27
|
|
|
|
|
57
|
|
|
|
27
|
|
|
|
|
621
|
|
|
5
|
|
|
|
|
|
|
use Digest::SHA qw(sha1_hex); |
|
6
|
27
|
|
|
27
|
|
11454
|
use Path::Tiny qw(path); |
|
|
27
|
|
|
|
|
59648
|
|
|
|
27
|
|
|
|
|
2089
|
|
|
7
|
27
|
|
|
27
|
|
5632
|
use Specio::Library::Path::Tiny; |
|
|
27
|
|
|
|
|
83454
|
|
|
|
27
|
|
|
|
|
1184
|
|
|
8
|
27
|
|
|
27
|
|
11406
|
|
|
|
27
|
|
|
|
|
2850244
|
|
|
|
27
|
|
|
|
|
336
|
|
|
9
|
|
|
|
|
|
|
use Moo; |
|
10
|
27
|
|
|
27
|
|
327752
|
|
|
|
27
|
|
|
|
|
243335
|
|
|
|
27
|
|
|
|
|
174
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.82'; |
|
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
|
2198
|
my $file = $self->_path_for_key($key); |
|
22
|
|
|
|
|
|
|
if ( $file->exists ) { |
|
23
|
114
|
|
|
|
|
312
|
return $file->slurp_raw; |
|
24
|
114
|
100
|
|
|
|
4409
|
} |
|
25
|
31
|
|
|
|
|
675
|
else { |
|
26
|
|
|
|
|
|
|
return undef; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
83
|
|
|
|
|
2517
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my ( $self, $key, $value ) = @_; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $file = $self->_path_for_key($key); |
|
33
|
78
|
|
|
78
|
0
|
1291
|
$file->parent->mkpath( { mode => 0755 } ); |
|
34
|
|
|
|
|
|
|
$file->spew_raw($value); |
|
35
|
78
|
|
|
|
|
257
|
|
|
36
|
78
|
|
|
|
|
3346
|
return; |
|
37
|
78
|
|
|
|
|
20366
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
78
|
|
|
|
|
30936
|
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
|
|
410
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
192
|
|
|
|
|
1041
|
|
|
54
|
192
|
|
|
|
|
1183
|
# 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.82 |
|
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 |