line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::BIMI::Role::CacheBackend; |
2
|
|
|
|
|
|
|
# ABSTRACT: Cache handling backend |
3
|
|
|
|
|
|
|
our $VERSION = '3.20210225'; # VERSION |
4
|
30
|
|
|
30
|
|
22300
|
use 5.20.0; |
|
30
|
|
|
|
|
146
|
|
5
|
30
|
|
|
30
|
|
231
|
use Moose::Role; |
|
30
|
|
|
|
|
108
|
|
|
30
|
|
|
|
|
1954
|
|
6
|
30
|
|
|
30
|
|
162341
|
use Mail::BIMI::Prelude; |
|
30
|
|
|
|
|
89
|
|
|
30
|
|
|
|
|
348
|
|
7
|
30
|
|
|
30
|
|
27125
|
use Digest::SHA; |
|
30
|
|
|
|
|
88026
|
|
|
30
|
|
|
|
|
6938
|
|
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
|
|
81
|
sub _build_cache_hash($self) { |
|
30
|
|
|
|
|
61
|
|
|
30
|
|
|
|
|
53
|
|
18
|
30
|
|
|
|
|
317
|
my $context = Digest::SHA->new; |
19
|
|
|
|
|
|
|
## TODO make sure there are no wide characters present in cache key |
20
|
30
|
|
|
|
|
1484
|
$context->add($self->parent->_cache_key); |
21
|
29
|
|
|
|
|
306
|
my $hash = $context->hexdigest; |
22
|
29
|
|
|
|
|
114
|
$hash =~ s/ //g; |
23
|
29
|
|
|
|
|
909
|
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.20210225 |
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 |