|
Revision 447
(checked in by miyagawa, 2 years ago)
|
Added plugin_id method to mean object ID, not class ID. Fixes #95
|
- Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 |
package Plagger::CacheProxy; |
|---|
| 2 |
use strict; |
|---|
| 3 |
|
|---|
| 4 |
sub new { |
|---|
| 5 |
my($class, $plugin, $cache) = @_; |
|---|
| 6 |
bless { |
|---|
| 7 |
namespace => $plugin->plugin_id, |
|---|
| 8 |
cache => $cache, |
|---|
| 9 |
}, $class; |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
no strict 'refs'; |
|---|
| 13 |
for my $meth (qw(get get_callback set remove)) { |
|---|
| 14 |
*{$meth} = sub { |
|---|
| 15 |
my $self = shift; |
|---|
| 16 |
my $key = shift; |
|---|
| 17 |
$key = "$self->{namespace}|$key"; |
|---|
| 18 |
$self->{cache}->$meth($key, @_); |
|---|
| 19 |
}; |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
sub path_to { |
|---|
| 23 |
my($self, @path) = @_; |
|---|
| 24 |
$self->{cache}->path_to($self->{namespace}, @path); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
sub cookie_jar { |
|---|
| 28 |
my $self = shift; |
|---|
| 29 |
$self->{cache}->cookie_jar($self->{namespace}); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
1; |
|---|