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

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

Return to bug 16769