View | Details | Raw Unified | Return to bug 16769
Collapse All | Expand All

(-)a/Koha/Cache.pm (-8 / +3 lines)
Lines 244-257 instance of C<Cache::*> and follow the same interface as L<Cache::Memcache>. Link Here
244
=cut
244
=cut
245
245
246
sub set_in_cache {
246
sub set_in_cache {
247
    my ( $self, $key, $value, $options, $_cache) = @_;
247
    my ( $self, $key, $value, $options ) = @_;
248
    # This is a bit of a hack to support the old API in case things still use it
248
249
    if (defined $options && (ref($options) ne 'HASH')) {
249
    my $unsafe = $options->{unsafe} || 0;
250
        my $new_options;
251
        $new_options->{expiry} = $options;
252
        $new_options->{cache} = $_cache if defined $_cache;
253
        $options = $new_options;
254
    }
255
250
256
    # the key mustn't contain whitespace (or control characters) for memcache
251
    # the key mustn't contain whitespace (or control characters) for memcache
257
    # but shouldn't be any harm in applying it globally.
252
    # but shouldn't be any harm in applying it globally.
(-)a/Koha/Calendar.pm (-1 / +1 lines)
Lines 125-131 sub single_holidays { Link Here
125
            $single_holidays->{$br} = \@ymd_arr;
125
            $single_holidays->{$br} = \@ymd_arr;
126
        }    # br
126
        }    # br
127
        $cache->set_in_cache( 'single_holidays', $single_holidays,
127
        $cache->set_in_cache( 'single_holidays', $single_holidays,
128
            76800 )    #24 hrs ;
128
            { expiry => 76800 } )    #24 hrs ;
129
    }
129
    }
130
    my $holidays  = ( $single_holidays->{$branchcode} );
130
    my $holidays  = ( $single_holidays->{$branchcode} );
131
    for my $hols  (@$holidays ) {
131
    for my $hols  (@$holidays ) {
(-)a/Koha/MetaSearcher.pm (-1 / +1 lines)
Lines 172-178 sub search { Link Here
172
                    hits => $result->{hits},
172
                    hits => $result->{hits},
173
                    num_fetched => $result->{num_fetched},
173
                    num_fetched => $result->{num_fetched},
174
                    num_hits => $result->{num_hits},
174
                    num_hits => $result->{num_hits},
175
                }, $resultset_expiry );
175
                }, { expiry => $resultset_expiry } );
176
            }
176
            }
177
        }
177
        }
178
    }
178
    }
(-)a/t/Cache.t (-4 / +3 lines)
Lines 54-69 SKIP: { Link Here
54
    }
54
    }
55
55
56
    # test expiry time in cache
56
    # test expiry time in cache
57
    $cache->set_in_cache( "timeout", "I AM DATA", 1 ); # expiry time of 1 second
57
    $cache->set_in_cache( "timeout", "I AM DATA", { expiry => 1 } ); # expiry time of 1 second
58
    sleep 2;
58
    sleep 2;
59
    $cache->flush_L1_cache();
59
    $cache->flush_L1_cache();
60
    is( $cache->get_from_cache("timeout"),
60
    is( $cache->get_from_cache("timeout"),
61
        undef, "fetching expired item from cache" );
61
        undef, "fetching expired item from cache" );
62
62
63
    # test fetching a valid, non expired, item from cache
63
    # test fetching a valid, non expired, item from cache
64
    $cache->set_in_cache( "clear_me", "I AM MORE DATA", 1000 )
64
    $cache->set_in_cache( "clear_me", "I AM MORE DATA", { expiry => 1000 } )
65
      ;    # overly large expiry time, clear below
65
      ;    # overly large expiry time, clear below
66
    $cache->set_in_cache( "dont_clear_me", "I AM MORE DATA22", 1000 )
66
    $cache->set_in_cache( "dont_clear_me", "I AM MORE DATA22", { expiry => 1000 } )
67
      ;    # overly large expiry time, clear below
67
      ;    # overly large expiry time, clear below
68
    is(
68
    is(
69
        $cache->get_from_cache("clear_me"),
69
        $cache->get_from_cache("clear_me"),
70
- 

Return to bug 16769