Fix purgeLocalCache script (#846)

This commit is contained in:
Clément Oudot 2015-09-21 14:02:48 +00:00
parent 9f689ed222
commit c0e4872250

View File

@ -2,7 +2,7 @@
#=============================================================================
# Cleaner for LemonLDAP::NG: purge local handler cache and session cache
#
# This module is written to be used by cron to clean cache objects used
# This module is written to be used by cron to clean cache objects used
# by Handler.
#
# This is part of LemonLDAP::NG product, released under GPL
@ -25,17 +25,20 @@ my $conf = $lmconf->getLocalConf(HANDLERSECTION)
print "Configuration loaded\n" if $debug;
# Handler cache
exit 0 unless ( $conf->{localStorage} );
eval "require $conf->{localStorage}";
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
$c->purge();
if ( $conf->{localStorage} ) {
eval "require $conf->{localStorage}";
$conf->{localStorageOptions}->{default_expires_in} ||= 600;
my $c = $conf->{localStorage}->new( $conf->{localStorageOptions} );
$c->purge();
}
# Session cache
exit 0 unless ( $conf->{localSessionStorage} );
eval "require $conf->{localSessionStorage}";
$conf->{localSessionStorageOptions}->{default_expires_in} ||= 600;
my $s = $conf->{localSessionStorage}->new( $conf->{localSessionStorageOptions} );
$s->purge();
if ( $conf->{localSessionStorage} ) {
eval "require $conf->{localSessionStorage}";
$conf->{localSessionStorageOptions}->{default_expires_in} ||= 600;
my $s =
$conf->{localSessionStorage}->new( $conf->{localSessionStorageOptions} );
$s->purge();
}
exit 0;