=cut
sub set_in_cache {
- my ( $self, $key, $value, $options, $_cache) = @_;
- # This is a bit of a hack to support the old API in case things still use it
- if (defined $options && (ref($options) ne 'HASH')) {
- my $new_options;
- $new_options->{expiry} = $options;
- $new_options->{cache} = $_cache if defined $_cache;
- $options = $new_options;
- }
+ my ( $self, $key, $value, $options ) = @_;
+
+ my $unsafe = $options->{unsafe} || 0;
# the key mustn't contain whitespace (or control characters) for memcache
# but shouldn't be any harm in applying it globally.
$single_holidays->{$br} = \@ymd_arr;
} # br
$cache->set_in_cache( 'single_holidays', $single_holidays,
- 76800 ) #24 hrs ;
+ { expiry => 76800 } ) #24 hrs ;
}
my $holidays = ( $single_holidays->{$branchcode} );
for my $hols (@$holidays ) {
hits => $result->{hits},
num_fetched => $result->{num_fetched},
num_hits => $result->{num_hits},
- }, $resultset_expiry );
+ }, { expiry => $resultset_expiry } );
}
}
}
}
# test expiry time in cache
- $cache->set_in_cache( "timeout", "I AM DATA", 1 ); # expiry time of 1 second
+ $cache->set_in_cache( "timeout", "I AM DATA", { expiry => 1 } ); # expiry time of 1 second
sleep 2;
$cache->flush_L1_cache();
is( $cache->get_from_cache("timeout"),
undef, "fetching expired item from cache" );
# test fetching a valid, non expired, item from cache
- $cache->set_in_cache( "clear_me", "I AM MORE DATA", 1000 )
+ $cache->set_in_cache( "clear_me", "I AM MORE DATA", { expiry => 1000 } )
; # overly large expiry time, clear below
- $cache->set_in_cache( "dont_clear_me", "I AM MORE DATA22", 1000 )
+ $cache->set_in_cache( "dont_clear_me", "I AM MORE DATA22", { expiry => 1000 } )
; # overly large expiry time, clear below
is(
$cache->get_from_cache("clear_me"),