line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::BIMI::CacheBackend::FastMmap; |
2
|
|
|
|
|
|
|
# ABSTRACT: Cache handling |
3
|
|
|
|
|
|
|
our $VERSION = '3.20210301'; # VERSION |
4
|
30
|
|
|
30
|
|
424
|
use 5.20.0; |
|
30
|
|
|
|
|
114
|
|
5
|
30
|
|
|
30
|
|
211
|
use Moose; |
|
30
|
|
|
|
|
89
|
|
|
30
|
|
|
|
|
534
|
|
6
|
30
|
|
|
30
|
|
230480
|
use Mail::BIMI::Prelude; |
|
30
|
|
|
|
|
100
|
|
|
30
|
|
|
|
|
277
|
|
7
|
30
|
|
|
30
|
|
28830
|
use Cache::FastMmap; |
|
30
|
|
|
|
|
155253
|
|
|
30
|
|
|
|
|
8059
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Mail::BIMI::Role::CacheBackend'; |
10
|
|
|
|
|
|
|
has _cache_fastmmap => ( is => 'rw', lazy => 1, builder => '_build_cache_fastmmap' ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
9
|
|
|
9
|
|
22
|
sub _build_cache_fastmmap($self) { |
|
9
|
|
|
|
|
37
|
|
|
9
|
|
|
|
|
26
|
|
14
|
9
|
|
|
|
|
259
|
my $cache_filename = $self->parent->bimi_object->options->cache_fastmmap_share_file; |
15
|
9
|
100
|
|
|
|
417
|
my $init_file = -e $cache_filename ? 0 : 1; |
16
|
9
|
|
|
|
|
105
|
my $cache = Cache::FastMmap->new( share_file => $cache_filename, serializer => 'sereal', init_file => $init_file, unlink_on_exit => 0 ); |
17
|
9
|
|
|
|
|
14346
|
return $cache; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
9
|
|
|
9
|
1
|
27
|
sub get_from_cache($self) { |
|
9
|
|
|
|
|
39
|
|
|
9
|
|
|
|
|
24
|
|
22
|
9
|
|
|
|
|
338
|
return $self->_cache_fastmmap->get($self->_cache_hash); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
1
|
11
|
sub put_to_cache($self,$data) { |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
12
|
|
27
|
2
|
|
|
|
|
74
|
$self->_cache_fastmmap->set($self->_cache_hash,$data); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
1
|
5
|
sub delete_cache($self) { |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
32
|
2
|
|
|
|
|
61
|
$self->_cache_fastmmap->remove($self->_cache_hash); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding UTF-8 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Mail::BIMI::CacheBackend::FastMmap - Cache handling |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 3.20210301 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Cache worker role for Cache::FastMmap backend |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
These values are derived from lookups and verifications made based upon the input values, it is however possible to override these with other values should you wish to, for example, validate a record before it is published in DNS, or validate an Indicator which is only available locally |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 parent |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
is=ro required |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Parent class for cacheing |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 CONSUMES |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Role::CacheBackend> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 EXTENDS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * L<Moose::Object> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 METHODS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 I<get_from_cache()> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Retrieve this class data from cache |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 I<put_to_cache($data)> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Put this classes data into the cache |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 I<delete_cache> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Delete the cache entry for this class |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 REQUIRES |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * L<Cache::FastMmap|Cache::FastMmap> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * L<Mail::BIMI::Prelude|Mail::BIMI::Prelude> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * L<Moose|Moose> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Marc Bradshaw <marc@marcbradshaw.net> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Marc Bradshaw. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |