line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cache::Funky::Storage::Simple; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw( Cache::Funky::Storage ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
603
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $_CACHE = {}; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub get { |
10
|
9
|
|
|
9
|
1
|
18
|
my $s = shift; |
11
|
9
|
|
|
|
|
16
|
my $key = shift; |
12
|
9
|
|
|
|
|
14
|
my $id = shift; |
13
|
|
|
|
|
|
|
|
14
|
9
|
100
|
|
|
|
61
|
return $id ? $_CACHE->{ $key }{ $id } : $_CACHE->{ $key }; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub set { |
18
|
6
|
|
|
6
|
1
|
10
|
my $s = shift; |
19
|
6
|
|
|
|
|
9
|
my $key = shift; |
20
|
6
|
|
|
|
|
8
|
my $value = shift; |
21
|
6
|
|
|
|
|
6
|
my $id = shift; |
22
|
|
|
|
|
|
|
|
23
|
6
|
100
|
|
|
|
17
|
if( $id ) { |
24
|
3
|
|
|
|
|
9
|
$_CACHE->{ $key }{ $id } = $value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
3
|
|
|
|
|
7
|
$_CACHE->{$key} = $value; |
28
|
|
|
|
|
|
|
} |
29
|
6
|
|
|
|
|
19
|
return 1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub delete { |
33
|
3
|
|
|
3
|
1
|
7
|
my $s = shift; |
34
|
3
|
|
|
|
|
7
|
my $key = shift; |
35
|
3
|
|
|
|
|
5
|
my $id = shift; |
36
|
|
|
|
|
|
|
|
37
|
3
|
100
|
|
|
|
33
|
$id ? delete $_CACHE->{ $key }{ $id } : delete $_CACHE->{ $key }; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Cache::Funky::Storage::Simple - Simple storage class. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use Cache::Funky::Storage::Simple; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This is not recommended to be used by your application. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 get( $key , [ $id ) |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 set( $key, $value , [ $id ) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 delete ( $key , [ $id ) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Masahiro Funakoshi |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |