Lines 38-43
The first, traditional OO interface provides the following functions:
Link Here
|
38 |
use strict; |
38 |
use strict; |
39 |
use warnings; |
39 |
use warnings; |
40 |
use Carp; |
40 |
use Carp; |
|
|
41 |
use Clone qw( clone ); |
41 |
use Module::Load::Conditional qw(can_load); |
42 |
use Module::Load::Conditional qw(can_load); |
42 |
use Koha::Cache::Object; |
43 |
use Koha::Cache::Object; |
43 |
|
44 |
|
Lines 313-319
sub get_from_cache {
Link Here
|
313 |
return unless ( $self->{$cache} && ref( $self->{$cache} ) =~ m/^Cache::/ ); |
314 |
return unless ( $self->{$cache} && ref( $self->{$cache} ) =~ m/^Cache::/ ); |
314 |
|
315 |
|
315 |
# Return L1 cache value if exists |
316 |
# Return L1 cache value if exists |
316 |
return $L1_cache{$key} if exists $L1_cache{$key}; |
317 |
if ( exists $L1_cache{$key} ) { |
|
|
318 |
# No need to deep copy if it's a scalar: |
319 |
return $L1_cache{$key} |
320 |
unless ref $L1_cache{$key}; |
321 |
return clone $L1_cache{$key}; |
322 |
} |
317 |
|
323 |
|
318 |
my $get_sub = $self->{ref($self->{$cache}) . "_get"}; |
324 |
my $get_sub = $self->{ref($self->{$cache}) . "_get"}; |
319 |
return $get_sub ? $get_sub->($key) : $self->{$cache}->get($key); |
325 |
return $get_sub ? $get_sub->($key) : $self->{$cache}->get($key); |
320 |
- |
|
|