line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: /mirror/coderepos/lang/perl/Data-Valve/trunk/lib/Data/Valve/Bucket.pm 66548 2008-07-22T00:38:42.978696Z daisuke $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Data::Valve::Bucket; |
4
|
1
|
|
|
1
|
|
2678
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
169
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
8
|
0
|
|
0
|
|
|
|
$args{strict_interval} ||= 0; |
9
|
0
|
|
|
|
|
|
my $self = bless create($args{interval}, $args{max_items}, $args{strict_interval}), $class; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
return $self; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub deserialize { |
15
|
0
|
|
|
0
|
1
|
|
my ($class, @args) = @_; |
16
|
0
|
|
|
|
|
|
return bless _deserialize(@args), $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Data::Valve::Bucket - A Data Bucket |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 new |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 create |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 try_push |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 expire |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 destroy |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 interval |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 max_items |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 count |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 serialize |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 deserialize |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 first |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 reset |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |