line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::BIMI::Role::CacheBackend; |
2
|
|
|
|
|
|
|
# ABSTRACT: Cache handling backend |
3
|
|
|
|
|
|
|
our $VERSION = '3.20210512'; # VERSION |
4
|
29
|
|
|
29
|
|
22116
|
use 5.20.0; |
|
29
|
|
|
|
|
137
|
|
5
|
29
|
|
|
29
|
|
218
|
use Moose::Role; |
|
29
|
|
|
|
|
120
|
|
|
29
|
|
|
|
|
1903
|
|
6
|
29
|
|
|
29
|
|
160009
|
use Mail::BIMI::Prelude; |
|
29
|
|
|
|
|
108
|
|
|
29
|
|
|
|
|
270
|
|
7
|
29
|
|
|
29
|
|
26802
|
use Digest::SHA; |
|
29
|
|
|
|
|
87444
|
|
|
29
|
|
|
|
|
6502
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has parent => ( is => 'ro', required => 1, weak_ref => 1, |
10
|
|
|
|
|
|
|
documentation => 'Parent class for cacheing' ); |
11
|
|
|
|
|
|
|
has _cache_hash => ( is => 'ro', lazy => 1, builder => '_build_cache_hash' ); |
12
|
|
|
|
|
|
|
requires 'get_from_cache'; |
13
|
|
|
|
|
|
|
requires 'put_to_cache'; |
14
|
|
|
|
|
|
|
requires 'delete_cache'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
30
|
|
|
30
|
|
59
|
sub _build_cache_hash($self) { |
|
30
|
|
|
|
|
59
|
|
|
30
|
|
|
|
|
50
|
|
18
|
30
|
|
|
|
|
283
|
my $context = Digest::SHA->new; |
19
|
|
|
|
|
|
|
## TODO make sure there are no wide characters present in cache key |
20
|
30
|
|
|
|
|
1360
|
$context->add($self->parent->_cache_key); |
21
|
29
|
|
|
|
|
269
|
my $hash = $context->hexdigest; |
22
|
29
|
|
|
|
|
108
|
$hash =~ s/ //g; |
23
|
29
|
|
|
|
|
848
|
return $hash; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=pod |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=encoding UTF-8 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Mail::BIMI::Role::CacheBackend - Cache handling backend |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 VERSION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
version 3.20210512 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Role for implementing a cache backend |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 REQUIRES |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over 4 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item * L<Digest::SHA|Digest::SHA> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Prelude|Mail::BIMI::Prelude> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item * L<Moose::Role|Moose::Role> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Marc Bradshaw <marc@marcbradshaw.net> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Marc Bradshaw. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
67
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |