Lines 37-43
sub new {
Link Here
|
37 |
} |
37 |
} |
38 |
else { |
38 |
else { |
39 |
require Koha::Cache; |
39 |
require Koha::Cache; |
40 |
$cache = Koha::Cache->new( { 'cache_type' => 'memcached', 'cache_servers' => C4::Context->config('memcached_servers') }); |
40 |
$cache = Koha::Cache->new( { 'cache_type' => 'memcached', 'cache_servers' => C4::Context->config('memcached_servers') }); |
41 |
} |
41 |
} |
42 |
my $self = bless { |
42 |
my $self = bless { |
43 |
CACHE => $cache, |
43 |
CACHE => $cache, |
Lines 77-91
sub _cached_action {
Link Here
|
77 |
':', |
77 |
':', |
78 |
( |
78 |
( |
79 |
$params->{template}, |
79 |
$params->{template}, |
80 |
map { "$_=$cache_keys->{$_}" } keys %{$cache_keys} |
80 |
map { "$_=$cache_keys->{$_}" } keys %{$cache_keys} |
81 |
) |
81 |
) |
82 |
); |
82 |
); |
83 |
} |
83 |
} |
84 |
my $result = $self->{CACHE}->get_from_cache($key); |
84 |
my $result = $self->{CACHE}->get_from_cache($key); |
85 |
if ( !$result ) { |
85 |
if ( !$result ) { |
86 |
warn "here in not in cache"; |
86 |
warn "here in not in cache"; |
87 |
$result = $self->{CONTEXT}->$action( $params->{template} ); |
87 |
$result = $self->{CONTEXT}->$action( $params->{template} ); |
88 |
$self->{CACHE}->set_in_cache( $key, $result, $params->{ttl} ); |
88 |
$self->{CACHE}->set_in_cache( $key, $result, $params->{ttl} ); |
89 |
} |
89 |
} |
90 |
return $result; |
90 |
return $result; |
91 |
} |
91 |
} |
92 |
- |
|
|